id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
154,200
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/Crypto.java
Crypto.signDataWithBase64
public String signDataWithBase64(byte[] data) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException { String res = null; byte[] signature = this.signData(data); // to base64 res = Base64.toBase64String(signature); return res; }
java
public String signDataWithBase64(byte[] data) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchProviderException, SignatureException { String res = null; byte[] signature = this.signData(data); // to base64 res = Base64.toBase64String(signature); return res; }
[ "public", "String", "signDataWithBase64", "(", "byte", "[", "]", "data", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", ",", "NoSuchProviderException", ",", "SignatureException", "{", "String", "res", "=", "null", ";", "byte", "[", "]", "signature", "=", "this", ".", "signData", "(", "data", ")", ";", "// to base64", "res", "=", "Base64", ".", "toBase64String", "(", "signature", ")", ";", "return", "res", ";", "}" ]
Generate the signature with the enrollment private key @param data data to sign @return the signature in base64 @throws SignatureException SignatureException @throws NoSuchProviderException NoSuchProviderException @throws NoSuchAlgorithmException NoSuchAlgorithmException @throws InvalidKeyException InvalidKeyException
[ "Generate", "the", "signature", "with", "the", "enrollment", "private", "key" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/Crypto.java#L190-L197
154,201
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/Crypto.java
Crypto.encryptWithBase64
public String encryptWithBase64(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { byte[] cipher = encryptBytes(data); return Base64.toBase64String(cipher); }
java
public String encryptWithBase64(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { byte[] cipher = encryptBytes(data); return Base64.toBase64String(cipher); }
[ "public", "String", "encryptWithBase64", "(", "byte", "[", "]", "data", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchProviderException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "IllegalBlockSizeException", ",", "BadPaddingException", ",", "InvalidAlgorithmParameterException", ",", "InvalidCipherTextException", ",", "IOException", "{", "byte", "[", "]", "cipher", "=", "encryptBytes", "(", "data", ")", ";", "return", "Base64", ".", "toBase64String", "(", "cipher", ")", ";", "}" ]
Encrypt data with TLS certificate and convert cipher to base64 @param data byte array to encrypt @return cipher in base64 @throws NoSuchAlgorithmException NoSuchAlgorithmException @throws NoSuchProviderException NoSuchProviderException @throws NoSuchPaddingException NoSuchPaddingException @throws InvalidKeyException InvalidKeyException @throws IllegalBlockSizeException IllegalBlockSizeException @throws BadPaddingException BadPaddingException @throws InvalidAlgorithmParameterException InvalidAlgorithmParameterException @throws IOException IOException @throws InvalidCipherTextException InvalidCipherTextException
[ "Encrypt", "data", "with", "TLS", "certificate", "and", "convert", "cipher", "to", "base64" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/Crypto.java#L239-L244
154,202
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/Crypto.java
Crypto.signAndEncrypt
public String signAndEncrypt(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, SignatureException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { String dataBase64 = Base64.toBase64String(data); String signBase64 = signDataWithBase64(data); JSONObject json = new JSONObject(); json.put("data", dataBase64); json.put("signature", signBase64); String dataStr = json.toString(); String cipher = encryptWithBase64(dataStr.getBytes()); return cipher; }
java
public String signAndEncrypt(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, SignatureException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { String dataBase64 = Base64.toBase64String(data); String signBase64 = signDataWithBase64(data); JSONObject json = new JSONObject(); json.put("data", dataBase64); json.put("signature", signBase64); String dataStr = json.toString(); String cipher = encryptWithBase64(dataStr.getBytes()); return cipher; }
[ "public", "String", "signAndEncrypt", "(", "byte", "[", "]", "data", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchProviderException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "IllegalBlockSizeException", ",", "BadPaddingException", ",", "SignatureException", ",", "InvalidAlgorithmParameterException", ",", "InvalidCipherTextException", ",", "IOException", "{", "String", "dataBase64", "=", "Base64", ".", "toBase64String", "(", "data", ")", ";", "String", "signBase64", "=", "signDataWithBase64", "(", "data", ")", ";", "JSONObject", "json", "=", "new", "JSONObject", "(", ")", ";", "json", ".", "put", "(", "\"data\"", ",", "dataBase64", ")", ";", "json", ".", "put", "(", "\"signature\"", ",", "signBase64", ")", ";", "String", "dataStr", "=", "json", ".", "toString", "(", ")", ";", "String", "cipher", "=", "encryptWithBase64", "(", "dataStr", ".", "getBytes", "(", ")", ")", ";", "return", "cipher", ";", "}" ]
Sign and encrypt data then convert cipher to base64 @param data data byte array to encrypt @return cipher in base64 @throws NoSuchAlgorithmException NoSuchAlgorithmException @throws NoSuchProviderException NoSuchProviderException @throws NoSuchPaddingException NoSuchPaddingException @throws InvalidKeyException InvalidKeyException @throws IllegalBlockSizeException IllegalBlockSizeException @throws BadPaddingException BadPaddingException @throws SignatureException SignatureException @throws InvalidAlgorithmParameterException InvalidAlgorithmParameterException @throws IOException IOException @throws InvalidCipherTextException InvalidCipherTextException
[ "Sign", "and", "encrypt", "data", "then", "convert", "cipher", "to", "base64" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/Crypto.java#L273-L284
154,203
arxanchain/java-common
src/main/java/com/arxanfintech/common/crypto/Crypto.java
Crypto.decryptAndVerify
public String decryptAndVerify(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, SignatureException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { // decode base64 byte[] base64DecodedData = Base64.decode(data); // decrypt data byte[] decryptedData = decryptBytes(base64DecodedData); // parse json structure JSONObject json = new JSONObject(new String(decryptedData)); String base64Data = json.getString("data"); String base64Sign = json.getString("signature"); // decode base64 of the original data and signature byte[] oriData = Base64.decode(base64Data.getBytes()); byte[] signature = Base64.decode(base64Sign.getBytes()); // verify the signature boolean verifyOK = verifyData(oriData, signature); if (!verifyOK) { return null; } // return the original data return new String(oriData); }
java
public String decryptAndVerify(byte[] data) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, SignatureException, InvalidAlgorithmParameterException, InvalidCipherTextException, IOException { // decode base64 byte[] base64DecodedData = Base64.decode(data); // decrypt data byte[] decryptedData = decryptBytes(base64DecodedData); // parse json structure JSONObject json = new JSONObject(new String(decryptedData)); String base64Data = json.getString("data"); String base64Sign = json.getString("signature"); // decode base64 of the original data and signature byte[] oriData = Base64.decode(base64Data.getBytes()); byte[] signature = Base64.decode(base64Sign.getBytes()); // verify the signature boolean verifyOK = verifyData(oriData, signature); if (!verifyOK) { return null; } // return the original data return new String(oriData); }
[ "public", "String", "decryptAndVerify", "(", "byte", "[", "]", "data", ")", "throws", "NoSuchAlgorithmException", ",", "NoSuchProviderException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "IllegalBlockSizeException", ",", "BadPaddingException", ",", "SignatureException", ",", "InvalidAlgorithmParameterException", ",", "InvalidCipherTextException", ",", "IOException", "{", "// decode base64", "byte", "[", "]", "base64DecodedData", "=", "Base64", ".", "decode", "(", "data", ")", ";", "// decrypt data", "byte", "[", "]", "decryptedData", "=", "decryptBytes", "(", "base64DecodedData", ")", ";", "// parse json structure", "JSONObject", "json", "=", "new", "JSONObject", "(", "new", "String", "(", "decryptedData", ")", ")", ";", "String", "base64Data", "=", "json", ".", "getString", "(", "\"data\"", ")", ";", "String", "base64Sign", "=", "json", ".", "getString", "(", "\"signature\"", ")", ";", "// decode base64 of the original data and signature", "byte", "[", "]", "oriData", "=", "Base64", ".", "decode", "(", "base64Data", ".", "getBytes", "(", ")", ")", ";", "byte", "[", "]", "signature", "=", "Base64", ".", "decode", "(", "base64Sign", ".", "getBytes", "(", ")", ")", ";", "// verify the signature", "boolean", "verifyOK", "=", "verifyData", "(", "oriData", ",", "signature", ")", ";", "if", "(", "!", "verifyOK", ")", "{", "return", "null", ";", "}", "// return the original data", "return", "new", "String", "(", "oriData", ")", ";", "}" ]
decrypt and verify signature of data @param data data byte array to decrypt and verify @return original plain text @throws NoSuchAlgorithmException NoSuchAlgorithmException @throws NoSuchProviderException NoSuchProviderException @throws NoSuchPaddingException NoSuchPaddingException @throws InvalidKeyException InvalidKeyException @throws IllegalBlockSizeException IllegalBlockSizeException @throws BadPaddingException BadPaddingException @throws SignatureException SignatureException @throws InvalidAlgorithmParameterException InvalidAlgorithmParameterException @throws IOException IOException @throws InvalidCipherTextException InvalidCipherTextException
[ "decrypt", "and", "verify", "signature", "of", "data" ]
3ddfedfd948f5bab3fee0b74b85cdce4702ed84e
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/Crypto.java#L313-L339
154,204
matiascamiletti/MCDropdownMenu
app/src/main/java/com/mobileia/mcdropdownmenu/example/ViewHolder.java
ViewHolder.get
@SuppressWarnings("unchecked") public static <T extends View> T get(View view, int id) { SparseArray<View> viewHolder = (SparseArray<View>) view.getTag(); if (viewHolder == null) { viewHolder = new SparseArray<View>(); view.setTag(viewHolder); } View childView = viewHolder.get(id); if (childView == null) { childView = view.findViewById(id); viewHolder.put(id, childView); } return (T) childView; }
java
@SuppressWarnings("unchecked") public static <T extends View> T get(View view, int id) { SparseArray<View> viewHolder = (SparseArray<View>) view.getTag(); if (viewHolder == null) { viewHolder = new SparseArray<View>(); view.setTag(viewHolder); } View childView = viewHolder.get(id); if (childView == null) { childView = view.findViewById(id); viewHolder.put(id, childView); } return (T) childView; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "View", ">", "T", "get", "(", "View", "view", ",", "int", "id", ")", "{", "SparseArray", "<", "View", ">", "viewHolder", "=", "(", "SparseArray", "<", "View", ">", ")", "view", ".", "getTag", "(", ")", ";", "if", "(", "viewHolder", "==", "null", ")", "{", "viewHolder", "=", "new", "SparseArray", "<", "View", ">", "(", ")", ";", "view", ".", "setTag", "(", "viewHolder", ")", ";", "}", "View", "childView", "=", "viewHolder", ".", "get", "(", "id", ")", ";", "if", "(", "childView", "==", "null", ")", "{", "childView", "=", "view", ".", "findViewById", "(", "id", ")", ";", "viewHolder", ".", "put", "(", "id", ",", "childView", ")", ";", "}", "return", "(", "T", ")", "childView", ";", "}" ]
I added a generic return type to reduce the casting noise in client code
[ "I", "added", "a", "generic", "return", "type", "to", "reduce", "the", "casting", "noise", "in", "client", "code" ]
eba3dac505c2b9945151430406aee82ed809ab15
https://github.com/matiascamiletti/MCDropdownMenu/blob/eba3dac505c2b9945151430406aee82ed809ab15/app/src/main/java/com/mobileia/mcdropdownmenu/example/ViewHolder.java#L11-L24
154,205
tvesalainen/util
util/src/main/java/org/vesalainen/navi/Area.java
Area.getArea
public static Area getArea(Location... locations) { if (locations.length == 2) { if (locations[0].getLongitude() == 0.0 && locations[1].getLongitude() == 0.0) { return getPolar(locations[0].getLatitude(), locations[1].getLatitude()); } else { throw new IllegalArgumentException(); } } else { return new ConvexArea(locations); } }
java
public static Area getArea(Location... locations) { if (locations.length == 2) { if (locations[0].getLongitude() == 0.0 && locations[1].getLongitude() == 0.0) { return getPolar(locations[0].getLatitude(), locations[1].getLatitude()); } else { throw new IllegalArgumentException(); } } else { return new ConvexArea(locations); } }
[ "public", "static", "Area", "getArea", "(", "Location", "...", "locations", ")", "{", "if", "(", "locations", ".", "length", "==", "2", ")", "{", "if", "(", "locations", "[", "0", "]", ".", "getLongitude", "(", ")", "==", "0.0", "&&", "locations", "[", "1", "]", ".", "getLongitude", "(", ")", "==", "0.0", ")", "{", "return", "getPolar", "(", "locations", "[", "0", "]", ".", "getLatitude", "(", ")", ",", "locations", "[", "1", "]", ".", "getLatitude", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "}", "else", "{", "return", "new", "ConvexArea", "(", "locations", ")", ";", "}", "}" ]
Returns area limited by given coordinates. Area must be convex. If exactly 2 locations are given the longitudes must be 0 defining polar area limited by latitudes. @param locations @return
[ "Returns", "area", "limited", "by", "given", "coordinates", ".", "Area", "must", "be", "convex", ".", "If", "exactly", "2", "locations", "are", "given", "the", "longitudes", "must", "be", "0", "defining", "polar", "area", "limited", "by", "latitudes", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Area.java#L77-L94
154,206
FitLayout/classify
src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java
ArticleFeatureExtractor.getMarkedness
public double getMarkedness(Area node) { double fsz = node.getFontSize() / avgfont; //use relative font size, 0 is the normal font double fwt = node.getFontWeight(); double fst = node.getFontStyle(); double ind = getIndentation(node); double cen = isCentered(node) ? 1.0 : 0.0; double contrast = getContrast(node); double cp = 1.0 - ca.getColorPercentage(node); double bcp = bca.getColorPercentage(node); bcp = (bcp < 0.0) ? 0.0 : (1.0 - bcp); //weighting double exp = weights[WFSZ] * fsz + weights[WFWT] * fwt + weights[WFST] * fst + weights[WIND] * ind + weights[WCON] * contrast + weights[WCEN] * cen + weights[WCP] * cp + weights[WBCP] * bcp; return exp; }
java
public double getMarkedness(Area node) { double fsz = node.getFontSize() / avgfont; //use relative font size, 0 is the normal font double fwt = node.getFontWeight(); double fst = node.getFontStyle(); double ind = getIndentation(node); double cen = isCentered(node) ? 1.0 : 0.0; double contrast = getContrast(node); double cp = 1.0 - ca.getColorPercentage(node); double bcp = bca.getColorPercentage(node); bcp = (bcp < 0.0) ? 0.0 : (1.0 - bcp); //weighting double exp = weights[WFSZ] * fsz + weights[WFWT] * fwt + weights[WFST] * fst + weights[WIND] * ind + weights[WCON] * contrast + weights[WCEN] * cen + weights[WCP] * cp + weights[WBCP] * bcp; return exp; }
[ "public", "double", "getMarkedness", "(", "Area", "node", ")", "{", "double", "fsz", "=", "node", ".", "getFontSize", "(", ")", "/", "avgfont", ";", "//use relative font size, 0 is the normal font", "double", "fwt", "=", "node", ".", "getFontWeight", "(", ")", ";", "double", "fst", "=", "node", ".", "getFontStyle", "(", ")", ";", "double", "ind", "=", "getIndentation", "(", "node", ")", ";", "double", "cen", "=", "isCentered", "(", "node", ")", "?", "1.0", ":", "0.0", ";", "double", "contrast", "=", "getContrast", "(", "node", ")", ";", "double", "cp", "=", "1.0", "-", "ca", ".", "getColorPercentage", "(", "node", ")", ";", "double", "bcp", "=", "bca", ".", "getColorPercentage", "(", "node", ")", ";", "bcp", "=", "(", "bcp", "<", "0.0", ")", "?", "0.0", ":", "(", "1.0", "-", "bcp", ")", ";", "//weighting", "double", "exp", "=", "weights", "[", "WFSZ", "]", "*", "fsz", "+", "weights", "[", "WFWT", "]", "*", "fwt", "+", "weights", "[", "WFST", "]", "*", "fst", "+", "weights", "[", "WIND", "]", "*", "ind", "+", "weights", "[", "WCON", "]", "*", "contrast", "+", "weights", "[", "WCEN", "]", "*", "cen", "+", "weights", "[", "WCP", "]", "*", "cp", "+", "weights", "[", "WBCP", "]", "*", "bcp", ";", "return", "exp", ";", "}" ]
Computes the markedness of the area. The markedness generally describes the visual importance of the area based on different criteria. @return the computed expressiveness
[ "Computes", "the", "markedness", "of", "the", "area", ".", "The", "markedness", "generally", "describes", "the", "visual", "importance", "of", "the", "area", "based", "on", "different", "criteria", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java#L152-L175
154,207
FitLayout/classify
src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java
ArticleFeatureExtractor.isCentered
private int isCentered(Area area, boolean askBefore, boolean askAfter) { Area parent = area.getParent(); if (parent != null) { int left = area.getX1() - parent.getX1(); int right = parent.getX2() - area.getX2(); int limit = (int) (((left + right) / 2.0) * CENTERING_THRESHOLD); if (limit == 0) limit = 1; //we always allow +-1px //System.out.println(this + " left=" + left + " right=" + right + " limit=" + limit); boolean middle = Math.abs(left - right) <= limit; //first guess - check if it is placed in the middle boolean fullwidth = left == 0 && right == 0; //centered because of full width if (!middle && !fullwidth) //not full width and certainly not in the middle { return 0; } else //may be centered - check the alignment { //compare the alignent with the previous and/or the next child Area prev = null; Area next = null; int pc = 2; //previous centered? int nc = 2; //next cenrered? if (askBefore || askAfter) { if (askBefore) { prev = area.getPreviousSibling(); while (prev != null && (pc = isCentered(prev, true, false)) == 2) prev = prev.getPreviousSibling(); } if (askAfter) { next = area.getNextSibling(); while (next != null && (nc = isCentered(next, false, true)) == 2) next = next.getNextSibling(); } } if (pc != 2 || nc != 2) //we have something for comparison { if (fullwidth) //cannot guess, compare with others { if (pc != 0 && nc != 0) //something around is centered - probably centered return 1; else return 0; } else //probably centered, if it is not left- or right-aligned with something around { if (prev != null && lrAligned(area, prev) == 1 || next != null && lrAligned(area, next) == 1) return 0; //aligned, not centered else return 1; //probably centered } } else //nothing to compare, just guess { if (fullwidth) return 2; //cannot guess from anything else return (middle ? 1 : 0); //nothing to compare with - guess from the position } } } else return 2; //no parent - we don't know }
java
private int isCentered(Area area, boolean askBefore, boolean askAfter) { Area parent = area.getParent(); if (parent != null) { int left = area.getX1() - parent.getX1(); int right = parent.getX2() - area.getX2(); int limit = (int) (((left + right) / 2.0) * CENTERING_THRESHOLD); if (limit == 0) limit = 1; //we always allow +-1px //System.out.println(this + " left=" + left + " right=" + right + " limit=" + limit); boolean middle = Math.abs(left - right) <= limit; //first guess - check if it is placed in the middle boolean fullwidth = left == 0 && right == 0; //centered because of full width if (!middle && !fullwidth) //not full width and certainly not in the middle { return 0; } else //may be centered - check the alignment { //compare the alignent with the previous and/or the next child Area prev = null; Area next = null; int pc = 2; //previous centered? int nc = 2; //next cenrered? if (askBefore || askAfter) { if (askBefore) { prev = area.getPreviousSibling(); while (prev != null && (pc = isCentered(prev, true, false)) == 2) prev = prev.getPreviousSibling(); } if (askAfter) { next = area.getNextSibling(); while (next != null && (nc = isCentered(next, false, true)) == 2) next = next.getNextSibling(); } } if (pc != 2 || nc != 2) //we have something for comparison { if (fullwidth) //cannot guess, compare with others { if (pc != 0 && nc != 0) //something around is centered - probably centered return 1; else return 0; } else //probably centered, if it is not left- or right-aligned with something around { if (prev != null && lrAligned(area, prev) == 1 || next != null && lrAligned(area, next) == 1) return 0; //aligned, not centered else return 1; //probably centered } } else //nothing to compare, just guess { if (fullwidth) return 2; //cannot guess from anything else return (middle ? 1 : 0); //nothing to compare with - guess from the position } } } else return 2; //no parent - we don't know }
[ "private", "int", "isCentered", "(", "Area", "area", ",", "boolean", "askBefore", ",", "boolean", "askAfter", ")", "{", "Area", "parent", "=", "area", ".", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "int", "left", "=", "area", ".", "getX1", "(", ")", "-", "parent", ".", "getX1", "(", ")", ";", "int", "right", "=", "parent", ".", "getX2", "(", ")", "-", "area", ".", "getX2", "(", ")", ";", "int", "limit", "=", "(", "int", ")", "(", "(", "(", "left", "+", "right", ")", "/", "2.0", ")", "*", "CENTERING_THRESHOLD", ")", ";", "if", "(", "limit", "==", "0", ")", "limit", "=", "1", ";", "//we always allow +-1px", "//System.out.println(this + \" left=\" + left + \" right=\" + right + \" limit=\" + limit);", "boolean", "middle", "=", "Math", ".", "abs", "(", "left", "-", "right", ")", "<=", "limit", ";", "//first guess - check if it is placed in the middle", "boolean", "fullwidth", "=", "left", "==", "0", "&&", "right", "==", "0", ";", "//centered because of full width", "if", "(", "!", "middle", "&&", "!", "fullwidth", ")", "//not full width and certainly not in the middle", "{", "return", "0", ";", "}", "else", "//may be centered - check the alignment", "{", "//compare the alignent with the previous and/or the next child", "Area", "prev", "=", "null", ";", "Area", "next", "=", "null", ";", "int", "pc", "=", "2", ";", "//previous centered?", "int", "nc", "=", "2", ";", "//next cenrered?", "if", "(", "askBefore", "||", "askAfter", ")", "{", "if", "(", "askBefore", ")", "{", "prev", "=", "area", ".", "getPreviousSibling", "(", ")", ";", "while", "(", "prev", "!=", "null", "&&", "(", "pc", "=", "isCentered", "(", "prev", ",", "true", ",", "false", ")", ")", "==", "2", ")", "prev", "=", "prev", ".", "getPreviousSibling", "(", ")", ";", "}", "if", "(", "askAfter", ")", "{", "next", "=", "area", ".", "getNextSibling", "(", ")", ";", "while", "(", "next", "!=", "null", "&&", "(", "nc", "=", "isCentered", "(", "next", ",", "false", ",", "true", ")", ")", "==", "2", ")", "next", "=", "next", ".", "getNextSibling", "(", ")", ";", "}", "}", "if", "(", "pc", "!=", "2", "||", "nc", "!=", "2", ")", "//we have something for comparison", "{", "if", "(", "fullwidth", ")", "//cannot guess, compare with others", "{", "if", "(", "pc", "!=", "0", "&&", "nc", "!=", "0", ")", "//something around is centered - probably centered", "return", "1", ";", "else", "return", "0", ";", "}", "else", "//probably centered, if it is not left- or right-aligned with something around", "{", "if", "(", "prev", "!=", "null", "&&", "lrAligned", "(", "area", ",", "prev", ")", "==", "1", "||", "next", "!=", "null", "&&", "lrAligned", "(", "area", ",", "next", ")", "==", "1", ")", "return", "0", ";", "//aligned, not centered", "else", "return", "1", ";", "//probably centered", "}", "}", "else", "//nothing to compare, just guess", "{", "if", "(", "fullwidth", ")", "return", "2", ";", "//cannot guess from anything", "else", "return", "(", "middle", "?", "1", ":", "0", ")", ";", "//nothing to compare with - guess from the position", "}", "}", "}", "else", "return", "2", ";", "//no parent - we don't know", "}" ]
Tries to guess whether the area is horizontally centered within its parent area @param askBefore may we compare the alignment with the preceding siblings? @param askAfter may we compare the alignment with the following siblings? @return 0 when certailny not centered, 1 when certainly centered, 2 when not sure (nothing to compare with and no margins around)
[ "Tries", "to", "guess", "whether", "the", "area", "is", "horizontally", "centered", "within", "its", "parent", "area" ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java#L232-L301
154,208
FitLayout/classify
src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java
ArticleFeatureExtractor.lrAligned
private int lrAligned(Area a1, Area a2) { if (a1.getX1() == a2.getX1()) return (a1.getX2() == a2.getX2()) ? 2 : 1; else if (a1.getX2() == a2.getX2()) return 1; else return 0; }
java
private int lrAligned(Area a1, Area a2) { if (a1.getX1() == a2.getX1()) return (a1.getX2() == a2.getX2()) ? 2 : 1; else if (a1.getX2() == a2.getX2()) return 1; else return 0; }
[ "private", "int", "lrAligned", "(", "Area", "a1", ",", "Area", "a2", ")", "{", "if", "(", "a1", ".", "getX1", "(", ")", "==", "a2", ".", "getX1", "(", ")", ")", "return", "(", "a1", ".", "getX2", "(", ")", "==", "a2", ".", "getX2", "(", ")", ")", "?", "2", ":", "1", ";", "else", "if", "(", "a1", ".", "getX2", "(", ")", "==", "a2", ".", "getX2", "(", ")", ")", "return", "1", ";", "else", "return", "0", ";", "}" ]
Checks if the areas are left- or right-aligned. @return 0 if not, 1 if yes, 2 if both left and right
[ "Checks", "if", "the", "areas", "are", "left", "-", "or", "right", "-", "aligned", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java#L307-L315
154,209
FitLayout/classify
src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java
ArticleFeatureExtractor.countAreas
private int countAreas(Area a, Rectangular r) { int ret = 0; for (int i = 0; i < a.getChildCount(); i++) { Area n = a.getChildAt(i); if (a.getTopology().getPosition(n).intersects(r)) ret++; } return ret; }
java
private int countAreas(Area a, Rectangular r) { int ret = 0; for (int i = 0; i < a.getChildCount(); i++) { Area n = a.getChildAt(i); if (a.getTopology().getPosition(n).intersects(r)) ret++; } return ret; }
[ "private", "int", "countAreas", "(", "Area", "a", ",", "Rectangular", "r", ")", "{", "int", "ret", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "getChildCount", "(", ")", ";", "i", "++", ")", "{", "Area", "n", "=", "a", ".", "getChildAt", "(", "i", ")", ";", "if", "(", "a", ".", "getTopology", "(", ")", ".", "getPosition", "(", "n", ")", ".", "intersects", "(", "r", ")", ")", "ret", "++", ";", "}", "return", "ret", ";", "}" ]
Counts the number of sub-areas in the specified region of the area @param a the area to be examined @param r the grid region of the area to be examined @return the number of visual areas in the specified area of the grid
[ "Counts", "the", "number", "of", "sub", "-", "areas", "in", "the", "specified", "region", "of", "the", "area" ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java#L346-L357
154,210
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/SessionProxy.java
SessionProxy.getRemoteTable
public RemoteTable getRemoteTable(String strRecordName) throws RemoteException { BaseTransport transport = this.createProxyTransport(GET_REMOTE_TABLE); transport.addParam(NAME, strRecordName); String strTableID = (String)transport.sendMessageAndGetReply(); // See if I have this one already TableProxy tableProxy = (TableProxy)this.getChildList().get(strTableID); if (tableProxy == null) tableProxy = new TableProxy(this, strTableID); // This will add it to my list return tableProxy; }
java
public RemoteTable getRemoteTable(String strRecordName) throws RemoteException { BaseTransport transport = this.createProxyTransport(GET_REMOTE_TABLE); transport.addParam(NAME, strRecordName); String strTableID = (String)transport.sendMessageAndGetReply(); // See if I have this one already TableProxy tableProxy = (TableProxy)this.getChildList().get(strTableID); if (tableProxy == null) tableProxy = new TableProxy(this, strTableID); // This will add it to my list return tableProxy; }
[ "public", "RemoteTable", "getRemoteTable", "(", "String", "strRecordName", ")", "throws", "RemoteException", "{", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "GET_REMOTE_TABLE", ")", ";", "transport", ".", "addParam", "(", "NAME", ",", "strRecordName", ")", ";", "String", "strTableID", "=", "(", "String", ")", "transport", ".", "sendMessageAndGetReply", "(", ")", ";", "// See if I have this one already", "TableProxy", "tableProxy", "=", "(", "TableProxy", ")", "this", ".", "getChildList", "(", ")", ".", "get", "(", "strTableID", ")", ";", "if", "(", "tableProxy", "==", "null", ")", "tableProxy", "=", "new", "TableProxy", "(", "this", ",", "strTableID", ")", ";", "// This will add it to my list", "return", "tableProxy", ";", "}" ]
Get this table for this session. @param strRecordName Table Name or Class Name of the record to find
[ "Get", "this", "table", "for", "this", "session", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/SessionProxy.java#L60-L70
154,211
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java
SetUserIDHandler.setUserID
public int setUserID(int iChangeType, boolean bDisplayOption) { int iErrorCode = DBConstants.NORMAL_RETURN; int iUserID = -1; if (this.getOwner().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID()); boolean bOldModified = this.getOwner().getField(userIdFieldName).isModified(); boolean[] rgbEnabled = null; if (iChangeType == DBConstants.INIT_MOVE) rgbEnabled = this.getOwner().getField(userIdFieldName).setEnableListeners(false); iErrorCode = this.getOwner().getField(userIdFieldName).setValue(iUserID, bDisplayOption, iChangeType); if (iChangeType == DBConstants.INIT_MOVE) { // Don't change the record on an init this.getOwner().getField(userIdFieldName).setEnableListeners(rgbEnabled); this.getOwner().getField(userIdFieldName).setModified(bOldModified); } return iErrorCode; }
java
public int setUserID(int iChangeType, boolean bDisplayOption) { int iErrorCode = DBConstants.NORMAL_RETURN; int iUserID = -1; if (this.getOwner().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecordOwner().getTask().getApplication()).getUserID()); boolean bOldModified = this.getOwner().getField(userIdFieldName).isModified(); boolean[] rgbEnabled = null; if (iChangeType == DBConstants.INIT_MOVE) rgbEnabled = this.getOwner().getField(userIdFieldName).setEnableListeners(false); iErrorCode = this.getOwner().getField(userIdFieldName).setValue(iUserID, bDisplayOption, iChangeType); if (iChangeType == DBConstants.INIT_MOVE) { // Don't change the record on an init this.getOwner().getField(userIdFieldName).setEnableListeners(rgbEnabled); this.getOwner().getField(userIdFieldName).setModified(bOldModified); } return iErrorCode; }
[ "public", "int", "setUserID", "(", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "int", "iUserID", "=", "-", "1", ";", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", ".", "length", "(", ")", ">", "0", ")", "iUserID", "=", "Integer", ".", "parseInt", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", ")", ";", "boolean", "bOldModified", "=", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "userIdFieldName", ")", ".", "isModified", "(", ")", ";", "boolean", "[", "]", "rgbEnabled", "=", "null", ";", "if", "(", "iChangeType", "==", "DBConstants", ".", "INIT_MOVE", ")", "rgbEnabled", "=", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "userIdFieldName", ")", ".", "setEnableListeners", "(", "false", ")", ";", "iErrorCode", "=", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "userIdFieldName", ")", ".", "setValue", "(", "iUserID", ",", "bDisplayOption", ",", "iChangeType", ")", ";", "if", "(", "iChangeType", "==", "DBConstants", ".", "INIT_MOVE", ")", "{", "// Don't change the record on an init", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "userIdFieldName", ")", ".", "setEnableListeners", "(", "rgbEnabled", ")", ";", "this", ".", "getOwner", "(", ")", ".", "getField", "(", "userIdFieldName", ")", ".", "setModified", "(", "bOldModified", ")", ";", "}", "return", "iErrorCode", ";", "}" ]
Set the user ID. @param iChangeType @param bDisplayOption The display option. @return The error code.
[ "Set", "the", "user", "ID", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SetUserIDHandler.java#L119-L139
154,212
tvesalainen/util
util/src/main/java/org/vesalainen/math/AngleAverage.java
AngleAverage.add
public void add(double rad, double weight) { sin += Math.sin(rad)*weight; cos += Math.cos(rad)*weight; }
java
public void add(double rad, double weight) { sin += Math.sin(rad)*weight; cos += Math.cos(rad)*weight; }
[ "public", "void", "add", "(", "double", "rad", ",", "double", "weight", ")", "{", "sin", "+=", "Math", ".", "sin", "(", "rad", ")", "*", "weight", ";", "cos", "+=", "Math", ".", "cos", "(", "rad", ")", "*", "weight", ";", "}" ]
Adds angle in radians with weight @param rad @param weight
[ "Adds", "angle", "in", "radians", "with", "weight" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/AngleAverage.java#L59-L63
154,213
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getGroups
public void getGroups(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGUTRPC FILGET", null, 3.8, startFrom, forward ? 1 : -1, MG_SCREEN, 40); toRecipients(lst, true, startFrom, result); }
java
public void getGroups(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGUTRPC FILGET", null, 3.8, startFrom, forward ? 1 : -1, MG_SCREEN, 40); toRecipients(lst, true, startFrom, result); }
[ "public", "void", "getGroups", "(", "String", "startFrom", ",", "boolean", "forward", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGUTRPC FILGET\"", ",", "null", ",", "3.8", ",", "startFrom", ",", "forward", "?", "1", ":", "-", "1", ",", "MG_SCREEN", ",", "40", ")", ";", "toRecipients", "(", "lst", ",", "true", ",", "startFrom", ",", "result", ")", ";", "}" ]
Returns a bolus of mail groups. @param startFrom Starting entry. @param forward Direction of traversal. @param result Result of lookup.
[ "Returns", "a", "bolus", "of", "mail", "groups", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L62-L65
154,214
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getUsers
public void getUsers(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWFUSR LOOKUP", null, startFrom, forward ? 1 : -1, null, null, "A"); toRecipients(lst, false, startFrom, result); }
java
public void getUsers(String startFrom, boolean forward, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWFUSR LOOKUP", null, startFrom, forward ? 1 : -1, null, null, "A"); toRecipients(lst, false, startFrom, result); }
[ "public", "void", "getUsers", "(", "String", "startFrom", ",", "boolean", "forward", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWFUSR LOOKUP\"", ",", "null", ",", "startFrom", ",", "forward", "?", "1", ":", "-", "1", ",", "null", ",", "null", ",", "\"A\"", ")", ";", "toRecipients", "(", "lst", ",", "false", ",", "startFrom", ",", "result", ")", ";", "}" ]
Returns a bolus of users. @param startFrom Starting entry. @param forward Direction of traversal. @param result Result of lookup.
[ "Returns", "a", "bolus", "of", "users", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L74-L77
154,215
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getNotifications
public void getNotifications(Patient patient, Collection<Notification> result) { List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
java
public void getNotifications(Patient patient, Collection<Notification> result) { List<String> lst = null; result.clear(); if (patient == null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null); } else if (patient != null) { lst = broker.callRPCList("RGCWXQ ALRLIST", null, patient.getIdElement().getIdPart()); } if (lst != null) { for (String item : lst) { result.add(new Notification(item)); } } }
[ "public", "void", "getNotifications", "(", "Patient", "patient", ",", "Collection", "<", "Notification", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "null", ";", "result", ".", "clear", "(", ")", ";", "if", "(", "patient", "==", "null", ")", "{", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ ALRLIST\"", ",", "null", ")", ";", "}", "else", "if", "(", "patient", "!=", "null", ")", "{", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ ALRLIST\"", ",", "null", ",", "patient", ".", "getIdElement", "(", ")", ".", "getIdPart", "(", ")", ")", ";", "}", "if", "(", "lst", "!=", "null", ")", "{", "for", "(", "String", "item", ":", "lst", ")", "{", "result", ".", "add", "(", "new", "Notification", "(", "item", ")", ")", ";", "}", "}", "}" ]
Returns notifications for the current user. @param patient If not null, only notifications associated with the current user are returned. Otherwise, all notifications for the current user are returned. @param result The list to receive the results.
[ "Returns", "notifications", "for", "the", "current", "user", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L86-L101
154,216
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.deleteNotification
public boolean deleteNotification(Notification notification) { boolean result = notification.canDelete(); if (result) { broker.callRPC("RGCWXQ ALRPP", notification.getAlertId()); } return result; }
java
public boolean deleteNotification(Notification notification) { boolean result = notification.canDelete(); if (result) { broker.callRPC("RGCWXQ ALRPP", notification.getAlertId()); } return result; }
[ "public", "boolean", "deleteNotification", "(", "Notification", "notification", ")", "{", "boolean", "result", "=", "notification", ".", "canDelete", "(", ")", ";", "if", "(", "result", ")", "{", "broker", ".", "callRPC", "(", "\"RGCWXQ ALRPP\"", ",", "notification", ".", "getAlertId", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Delete a notification. @param notification The notification to delete. @return True if the operation was successful.
[ "Delete", "a", "notification", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L109-L117
154,217
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.forwardNotifications
public void forwardNotifications(Collection<Notification> notifications, Collection<Recipient> recipients, String comment) { List<String> lst1 = new ArrayList<>(); for (Notification notification : notifications) { lst1.add(notification.getAlertId()); } List<Long> lst2 = prepareRecipients(recipients); if (!lst1.isEmpty() && !lst2.isEmpty()) { broker.callRPC("RGCWXQ FORWARD", lst1, lst2, comment); } }
java
public void forwardNotifications(Collection<Notification> notifications, Collection<Recipient> recipients, String comment) { List<String> lst1 = new ArrayList<>(); for (Notification notification : notifications) { lst1.add(notification.getAlertId()); } List<Long> lst2 = prepareRecipients(recipients); if (!lst1.isEmpty() && !lst2.isEmpty()) { broker.callRPC("RGCWXQ FORWARD", lst1, lst2, comment); } }
[ "public", "void", "forwardNotifications", "(", "Collection", "<", "Notification", ">", "notifications", ",", "Collection", "<", "Recipient", ">", "recipients", ",", "String", "comment", ")", "{", "List", "<", "String", ">", "lst1", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Notification", "notification", ":", "notifications", ")", "{", "lst1", ".", "add", "(", "notification", ".", "getAlertId", "(", ")", ")", ";", "}", "List", "<", "Long", ">", "lst2", "=", "prepareRecipients", "(", "recipients", ")", ";", "if", "(", "!", "lst1", ".", "isEmpty", "(", ")", "&&", "!", "lst2", ".", "isEmpty", "(", ")", ")", "{", "broker", ".", "callRPC", "(", "\"RGCWXQ FORWARD\"", ",", "lst1", ",", "lst2", ",", "comment", ")", ";", "}", "}" ]
Forward multiple notifications. @param notifications List of notifications to forward. @param recipients List of recipients. @param comment Comment to attach to forwarded notification.
[ "Forward", "multiple", "notifications", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L126-L139
154,218
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.prepareRecipients
private List<Long> prepareRecipients(Collection<Recipient> recipients) { List<Long> lst = new ArrayList<>(); for (Recipient recipient : recipients) { lst.add(recipient.getIen()); } return lst; }
java
private List<Long> prepareRecipients(Collection<Recipient> recipients) { List<Long> lst = new ArrayList<>(); for (Recipient recipient : recipients) { lst.add(recipient.getIen()); } return lst; }
[ "private", "List", "<", "Long", ">", "prepareRecipients", "(", "Collection", "<", "Recipient", ">", "recipients", ")", "{", "List", "<", "Long", ">", "lst", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Recipient", "recipient", ":", "recipients", ")", "{", "lst", ".", "add", "(", "recipient", ".", "getIen", "(", ")", ")", ";", "}", "return", "lst", ";", "}" ]
Prepares a recipient list for passing to an RPC. @param recipients List of recipients. @return List of recipients to pass to RPC.
[ "Prepares", "a", "recipient", "list", "for", "passing", "to", "an", "RPC", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L147-L155
154,219
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.toRecipients
private void toRecipients(List<String> recipientData, boolean isGroup, String filter, Collection<Recipient> result) { result.clear(); for (String data : recipientData) { Recipient recipient = new Recipient(data, isGroup); if (StringUtils.startsWithIgnoreCase(recipient.getName(), filter)) { result.add(recipient); } else { break; } } }
java
private void toRecipients(List<String> recipientData, boolean isGroup, String filter, Collection<Recipient> result) { result.clear(); for (String data : recipientData) { Recipient recipient = new Recipient(data, isGroup); if (StringUtils.startsWithIgnoreCase(recipient.getName(), filter)) { result.add(recipient); } else { break; } } }
[ "private", "void", "toRecipients", "(", "List", "<", "String", ">", "recipientData", ",", "boolean", "isGroup", ",", "String", "filter", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "result", ".", "clear", "(", ")", ";", "for", "(", "String", "data", ":", "recipientData", ")", "{", "Recipient", "recipient", "=", "new", "Recipient", "(", "data", ",", "isGroup", ")", ";", "if", "(", "StringUtils", ".", "startsWithIgnoreCase", "(", "recipient", ".", "getName", "(", ")", ",", "filter", ")", ")", "{", "result", ".", "add", "(", "recipient", ")", ";", "}", "else", "{", "break", ";", "}", "}", "}" ]
Creates a list of recipients from a list of raw data. @param recipientData List of raw data as returned by lookup. @param isGroup If true, the list represents mail groups. If false, it represents users. @param filter The text used in the lookup. It will be used to limit the returned results. @param result List of recipients.
[ "Creates", "a", "list", "of", "recipients", "from", "a", "list", "of", "raw", "data", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L165-L177
154,220
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getNotificationMessage
public List<String> getNotificationMessage(Notification notification) { List<String> message = notification.getMessage(); if (message == null) { message = broker.callRPCList("RGCWXQ ALRMSG", null, notification.getAlertId()); notification.setMessage(message); } return message; }
java
public List<String> getNotificationMessage(Notification notification) { List<String> message = notification.getMessage(); if (message == null) { message = broker.callRPCList("RGCWXQ ALRMSG", null, notification.getAlertId()); notification.setMessage(message); } return message; }
[ "public", "List", "<", "String", ">", "getNotificationMessage", "(", "Notification", "notification", ")", "{", "List", "<", "String", ">", "message", "=", "notification", ".", "getMessage", "(", ")", ";", "if", "(", "message", "==", "null", ")", "{", "message", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ ALRMSG\"", ",", "null", ",", "notification", ".", "getAlertId", "(", ")", ")", ";", "notification", ".", "setMessage", "(", "message", ")", ";", "}", "return", "message", ";", "}" ]
Returns the message associated with a notification, fetching it from the server if necessary. @param notification A notification. @return Message associated with the notification.
[ "Returns", "the", "message", "associated", "with", "a", "notification", "fetching", "it", "from", "the", "server", "if", "necessary", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L185-L194
154,221
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getScheduledNotifications
public void getScheduledNotifications(Collection<ScheduledNotification> result) { List<String> lst = broker.callRPCList("RGCWXQ SCHLIST", null, scheduledPrefix); result.clear(); for (String data : lst) { result.add(new ScheduledNotification(data)); } }
java
public void getScheduledNotifications(Collection<ScheduledNotification> result) { List<String> lst = broker.callRPCList("RGCWXQ SCHLIST", null, scheduledPrefix); result.clear(); for (String data : lst) { result.add(new ScheduledNotification(data)); } }
[ "public", "void", "getScheduledNotifications", "(", "Collection", "<", "ScheduledNotification", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ SCHLIST\"", ",", "null", ",", "scheduledPrefix", ")", ";", "result", ".", "clear", "(", ")", ";", "for", "(", "String", "data", ":", "lst", ")", "{", "result", ".", "add", "(", "new", "ScheduledNotification", "(", "data", ")", ")", ";", "}", "}" ]
Returns all scheduled notifications for the current user. @param result The list to receive the results.
[ "Returns", "all", "scheduled", "notifications", "for", "the", "current", "user", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L201-L208
154,222
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getScheduledNotificationRecipients
public void getScheduledNotificationRecipients(ScheduledNotification notification, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWXQ SCHRECIP", null, notification.getIen()); result.clear(); for (String data : lst) { result.add(new Recipient(data)); } }
java
public void getScheduledNotificationRecipients(ScheduledNotification notification, Collection<Recipient> result) { List<String> lst = broker.callRPCList("RGCWXQ SCHRECIP", null, notification.getIen()); result.clear(); for (String data : lst) { result.add(new Recipient(data)); } }
[ "public", "void", "getScheduledNotificationRecipients", "(", "ScheduledNotification", "notification", ",", "Collection", "<", "Recipient", ">", "result", ")", "{", "List", "<", "String", ">", "lst", "=", "broker", ".", "callRPCList", "(", "\"RGCWXQ SCHRECIP\"", ",", "null", ",", "notification", ".", "getIen", "(", ")", ")", ";", "result", ".", "clear", "(", ")", ";", "for", "(", "String", "data", ":", "lst", ")", "{", "result", ".", "add", "(", "new", "Recipient", "(", "data", ")", ")", ";", "}", "}" ]
Returns a list of recipients associated with a scheduled notification. @param notification A scheduled notification. @param result Recipients associated with the notification.
[ "Returns", "a", "list", "of", "recipients", "associated", "with", "a", "scheduled", "notification", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L226-L233
154,223
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.getScheduledNotificationMessage
public List<String> getScheduledNotificationMessage(ScheduledNotification notification) { return broker.callRPCList("RGCWXQ SCHMSG", null, notification.getIen()); }
java
public List<String> getScheduledNotificationMessage(ScheduledNotification notification) { return broker.callRPCList("RGCWXQ SCHMSG", null, notification.getIen()); }
[ "public", "List", "<", "String", ">", "getScheduledNotificationMessage", "(", "ScheduledNotification", "notification", ")", "{", "return", "broker", ".", "callRPCList", "(", "\"RGCWXQ SCHMSG\"", ",", "null", ",", "notification", ".", "getIen", "(", ")", ")", ";", "}" ]
Returns the message associated with a scheduled notification. @param notification A scheduled notification. @return Message associated with the scheduled notification.
[ "Returns", "the", "message", "associated", "with", "a", "scheduled", "notification", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L241-L243
154,224
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java
NotificationService.scheduleNotification
public boolean scheduleNotification(ScheduledNotification notification, List<String> message, Collection<Recipient> recipients) { if (notification.getIen() > 0) { deleteScheduledNotification(notification); } String extraInfo = StrUtil.fromList(Arrays.asList(notification.getExtraInfo()), StrUtil.U); return broker.callRPCBool("RGCWXQ SCHALR", notification.getDeliveryDate(), scheduledPrefix, notification.getSubject(), extraInfo, message, prepareRecipients(recipients)); }
java
public boolean scheduleNotification(ScheduledNotification notification, List<String> message, Collection<Recipient> recipients) { if (notification.getIen() > 0) { deleteScheduledNotification(notification); } String extraInfo = StrUtil.fromList(Arrays.asList(notification.getExtraInfo()), StrUtil.U); return broker.callRPCBool("RGCWXQ SCHALR", notification.getDeliveryDate(), scheduledPrefix, notification.getSubject(), extraInfo, message, prepareRecipients(recipients)); }
[ "public", "boolean", "scheduleNotification", "(", "ScheduledNotification", "notification", ",", "List", "<", "String", ">", "message", ",", "Collection", "<", "Recipient", ">", "recipients", ")", "{", "if", "(", "notification", ".", "getIen", "(", ")", ">", "0", ")", "{", "deleteScheduledNotification", "(", "notification", ")", ";", "}", "String", "extraInfo", "=", "StrUtil", ".", "fromList", "(", "Arrays", ".", "asList", "(", "notification", ".", "getExtraInfo", "(", ")", ")", ",", "StrUtil", ".", "U", ")", ";", "return", "broker", ".", "callRPCBool", "(", "\"RGCWXQ SCHALR\"", ",", "notification", ".", "getDeliveryDate", "(", ")", ",", "scheduledPrefix", ",", "notification", ".", "getSubject", "(", ")", ",", "extraInfo", ",", "message", ",", "prepareRecipients", "(", "recipients", ")", ")", ";", "}" ]
Creates a schedule notification. If the notification is replacing an existing one, the existing one will be first deleted and a new one created in its place. @param notification Notification to be scheduled. @param message The associated message, if any. @param recipients The target recipients. @return True if the notification was successfully scheduled.
[ "Creates", "a", "schedule", "notification", ".", "If", "the", "notification", "is", "replacing", "an", "existing", "one", "the", "existing", "one", "will", "be", "first", "deleted", "and", "a", "new", "one", "created", "in", "its", "place", "." ]
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/NotificationService.java#L254-L263
154,225
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/JDocBookBuilder.java
JDocBookBuilder.addPublicanCommonContentToBook
protected void addPublicanCommonContentToBook(final BuildData buildData) throws BuildProcessingException { final ContentSpec contentSpec = buildData.getContentSpec(); final String commonContentLocale = buildData.getOutputLocale(); final String commonContentDirectory = buildData.getBuildOptions().getCommonContentDirectory() == null ? BuilderConstants .LINUX_PUBLICAN_COMMON_CONTENT : buildData.getBuildOptions().getCommonContentDirectory(); final String defaultBrand = buildData.getDocBookVersion() == DocBookVersion.DOCBOOK_50 ? BuilderConstants.DEFAULT_DB50_BRAND : BuilderConstants.DEFAULT_DB45_BRAND; final String brand = contentSpec.getBrand() == null ? defaultBrand : contentSpec.getBrand(); final String brandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + brand + File.separator + commonContentLocale + File.separator; final String commonBrandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + BuilderConstants.DEFAULT_DB45_BRAND + File.separator + commonContentLocale + File.separator; final String commonEnglishBrandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + BuilderConstants.DEFAULT_DB45_BRAND + File.separator + "en-US" + File.separator; /* * We need to pull the Conventions.xml, Feedback.xml & Legal_Notice.xml from the publican Common_Content directory. * First we need to check if the files exist for the brand, if they don't then we need to check the common directory, * starting with the specified locale and defaulting to english. */ for (final String fileName : BuilderConstants.COMMON_CONTENT_FILES) { final File brandFile = new File(brandDir + fileName); // Find the required file final String file; if (brandFile.exists() && brandFile.isFile()) { file = FileUtilities.readFileContents(brandFile); } else { final File commonBrandFile = new File(commonBrandDir + fileName); if (commonBrandFile.exists() && commonBrandFile.isFile()) { file = FileUtilities.readFileContents(commonBrandFile); } else { final File commonEnglishBrandFile = new File(commonEnglishBrandDir + fileName); if (commonEnglishBrandFile.exists() && commonEnglishBrandFile.isFile()) { file = FileUtilities.readFileContents(commonEnglishBrandFile); } else { continue; } } } if (file != null) { // Set the root element name based on the file final String rootElementName; if (fileName.equals("Program_Listing.xml")) { rootElementName = "programlisting"; } else if (fileName.equals("Legal_Notice.xml")) { rootElementName = "legalnotice"; } else { rootElementName = "section"; } // Fix the Doctype final String entityFileName = "../" + buildData.getEntityFileName(); final String fixedFile = DocBookBuildUtilities.addDocBookPreamble(buildData.getDocBookVersion(), file, rootElementName, entityFileName); // Add the file to the book addToZip(buildData.getBookLocaleFolder() + "Common_Content/" + fileName, fixedFile, buildData); } } }
java
protected void addPublicanCommonContentToBook(final BuildData buildData) throws BuildProcessingException { final ContentSpec contentSpec = buildData.getContentSpec(); final String commonContentLocale = buildData.getOutputLocale(); final String commonContentDirectory = buildData.getBuildOptions().getCommonContentDirectory() == null ? BuilderConstants .LINUX_PUBLICAN_COMMON_CONTENT : buildData.getBuildOptions().getCommonContentDirectory(); final String defaultBrand = buildData.getDocBookVersion() == DocBookVersion.DOCBOOK_50 ? BuilderConstants.DEFAULT_DB50_BRAND : BuilderConstants.DEFAULT_DB45_BRAND; final String brand = contentSpec.getBrand() == null ? defaultBrand : contentSpec.getBrand(); final String brandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + brand + File.separator + commonContentLocale + File.separator; final String commonBrandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + BuilderConstants.DEFAULT_DB45_BRAND + File.separator + commonContentLocale + File.separator; final String commonEnglishBrandDir = commonContentDirectory + (commonContentDirectory.endsWith( "/") ? "" : "/") + BuilderConstants.DEFAULT_DB45_BRAND + File.separator + "en-US" + File.separator; /* * We need to pull the Conventions.xml, Feedback.xml & Legal_Notice.xml from the publican Common_Content directory. * First we need to check if the files exist for the brand, if they don't then we need to check the common directory, * starting with the specified locale and defaulting to english. */ for (final String fileName : BuilderConstants.COMMON_CONTENT_FILES) { final File brandFile = new File(brandDir + fileName); // Find the required file final String file; if (brandFile.exists() && brandFile.isFile()) { file = FileUtilities.readFileContents(brandFile); } else { final File commonBrandFile = new File(commonBrandDir + fileName); if (commonBrandFile.exists() && commonBrandFile.isFile()) { file = FileUtilities.readFileContents(commonBrandFile); } else { final File commonEnglishBrandFile = new File(commonEnglishBrandDir + fileName); if (commonEnglishBrandFile.exists() && commonEnglishBrandFile.isFile()) { file = FileUtilities.readFileContents(commonEnglishBrandFile); } else { continue; } } } if (file != null) { // Set the root element name based on the file final String rootElementName; if (fileName.equals("Program_Listing.xml")) { rootElementName = "programlisting"; } else if (fileName.equals("Legal_Notice.xml")) { rootElementName = "legalnotice"; } else { rootElementName = "section"; } // Fix the Doctype final String entityFileName = "../" + buildData.getEntityFileName(); final String fixedFile = DocBookBuildUtilities.addDocBookPreamble(buildData.getDocBookVersion(), file, rootElementName, entityFileName); // Add the file to the book addToZip(buildData.getBookLocaleFolder() + "Common_Content/" + fileName, fixedFile, buildData); } } }
[ "protected", "void", "addPublicanCommonContentToBook", "(", "final", "BuildData", "buildData", ")", "throws", "BuildProcessingException", "{", "final", "ContentSpec", "contentSpec", "=", "buildData", ".", "getContentSpec", "(", ")", ";", "final", "String", "commonContentLocale", "=", "buildData", ".", "getOutputLocale", "(", ")", ";", "final", "String", "commonContentDirectory", "=", "buildData", ".", "getBuildOptions", "(", ")", ".", "getCommonContentDirectory", "(", ")", "==", "null", "?", "BuilderConstants", ".", "LINUX_PUBLICAN_COMMON_CONTENT", ":", "buildData", ".", "getBuildOptions", "(", ")", ".", "getCommonContentDirectory", "(", ")", ";", "final", "String", "defaultBrand", "=", "buildData", ".", "getDocBookVersion", "(", ")", "==", "DocBookVersion", ".", "DOCBOOK_50", "?", "BuilderConstants", ".", "DEFAULT_DB50_BRAND", ":", "BuilderConstants", ".", "DEFAULT_DB45_BRAND", ";", "final", "String", "brand", "=", "contentSpec", ".", "getBrand", "(", ")", "==", "null", "?", "defaultBrand", ":", "contentSpec", ".", "getBrand", "(", ")", ";", "final", "String", "brandDir", "=", "commonContentDirectory", "+", "(", "commonContentDirectory", ".", "endsWith", "(", "\"/\"", ")", "?", "\"\"", ":", "\"/\"", ")", "+", "brand", "+", "File", ".", "separator", "+", "commonContentLocale", "+", "File", ".", "separator", ";", "final", "String", "commonBrandDir", "=", "commonContentDirectory", "+", "(", "commonContentDirectory", ".", "endsWith", "(", "\"/\"", ")", "?", "\"\"", ":", "\"/\"", ")", "+", "BuilderConstants", ".", "DEFAULT_DB45_BRAND", "+", "File", ".", "separator", "+", "commonContentLocale", "+", "File", ".", "separator", ";", "final", "String", "commonEnglishBrandDir", "=", "commonContentDirectory", "+", "(", "commonContentDirectory", ".", "endsWith", "(", "\"/\"", ")", "?", "\"\"", ":", "\"/\"", ")", "+", "BuilderConstants", ".", "DEFAULT_DB45_BRAND", "+", "File", ".", "separator", "+", "\"en-US\"", "+", "File", ".", "separator", ";", "/*\n * We need to pull the Conventions.xml, Feedback.xml & Legal_Notice.xml from the publican Common_Content directory.\n * First we need to check if the files exist for the brand, if they don't then we need to check the common directory,\n * starting with the specified locale and defaulting to english.\n */", "for", "(", "final", "String", "fileName", ":", "BuilderConstants", ".", "COMMON_CONTENT_FILES", ")", "{", "final", "File", "brandFile", "=", "new", "File", "(", "brandDir", "+", "fileName", ")", ";", "// Find the required file", "final", "String", "file", ";", "if", "(", "brandFile", ".", "exists", "(", ")", "&&", "brandFile", ".", "isFile", "(", ")", ")", "{", "file", "=", "FileUtilities", ".", "readFileContents", "(", "brandFile", ")", ";", "}", "else", "{", "final", "File", "commonBrandFile", "=", "new", "File", "(", "commonBrandDir", "+", "fileName", ")", ";", "if", "(", "commonBrandFile", ".", "exists", "(", ")", "&&", "commonBrandFile", ".", "isFile", "(", ")", ")", "{", "file", "=", "FileUtilities", ".", "readFileContents", "(", "commonBrandFile", ")", ";", "}", "else", "{", "final", "File", "commonEnglishBrandFile", "=", "new", "File", "(", "commonEnglishBrandDir", "+", "fileName", ")", ";", "if", "(", "commonEnglishBrandFile", ".", "exists", "(", ")", "&&", "commonEnglishBrandFile", ".", "isFile", "(", ")", ")", "{", "file", "=", "FileUtilities", ".", "readFileContents", "(", "commonEnglishBrandFile", ")", ";", "}", "else", "{", "continue", ";", "}", "}", "}", "if", "(", "file", "!=", "null", ")", "{", "// Set the root element name based on the file", "final", "String", "rootElementName", ";", "if", "(", "fileName", ".", "equals", "(", "\"Program_Listing.xml\"", ")", ")", "{", "rootElementName", "=", "\"programlisting\"", ";", "}", "else", "if", "(", "fileName", ".", "equals", "(", "\"Legal_Notice.xml\"", ")", ")", "{", "rootElementName", "=", "\"legalnotice\"", ";", "}", "else", "{", "rootElementName", "=", "\"section\"", ";", "}", "// Fix the Doctype", "final", "String", "entityFileName", "=", "\"../\"", "+", "buildData", ".", "getEntityFileName", "(", ")", ";", "final", "String", "fixedFile", "=", "DocBookBuildUtilities", ".", "addDocBookPreamble", "(", "buildData", ".", "getDocBookVersion", "(", ")", ",", "file", ",", "rootElementName", ",", "entityFileName", ")", ";", "// Add the file to the book", "addToZip", "(", "buildData", ".", "getBookLocaleFolder", "(", ")", "+", "\"Common_Content/\"", "+", "fileName", ",", "fixedFile", ",", "buildData", ")", ";", "}", "}", "}" ]
Adds the Publican Common_Content files specified by the brand, locale and directory location build options . If the Common_Content files don't exist at the directory, brand and locale specified then the "common" brand will be used instead. If the file still don't exist then the files are skipped and will rely on XML XI Include Fallbacks. @param buildData
[ "Adds", "the", "Publican", "Common_Content", "files", "specified", "by", "the", "brand", "locale", "and", "directory", "location", "build", "options", ".", "If", "the", "Common_Content", "files", "don", "t", "exist", "at", "the", "directory", "brand", "and", "locale", "specified", "then", "the", "common", "brand", "will", "be", "used", "instead", ".", "If", "the", "file", "still", "don", "t", "exist", "then", "the", "files", "are", "skipped", "and", "will", "rely", "on", "XML", "XI", "Include", "Fallbacks", "." ]
5436d36ba1b3c5baa246b270e5fc350e6778bce8
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/JDocBookBuilder.java#L93-L156
154,226
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java
Specifier.resolveFields
private static List<String> resolveFields(final Iterable<? extends String> fields) { final List<String> fieldList = new ArrayList<String>(); for (final String field : fields) { Validate.isTrue(StringUtils.isNotBlank(field), "One of the specified fields was blank"); fieldList.add(field.trim()); } return fieldList; }
java
private static List<String> resolveFields(final Iterable<? extends String> fields) { final List<String> fieldList = new ArrayList<String>(); for (final String field : fields) { Validate.isTrue(StringUtils.isNotBlank(field), "One of the specified fields was blank"); fieldList.add(field.trim()); } return fieldList; }
[ "private", "static", "List", "<", "String", ">", "resolveFields", "(", "final", "Iterable", "<", "?", "extends", "String", ">", "fields", ")", "{", "final", "List", "<", "String", ">", "fieldList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "final", "String", "field", ":", "fields", ")", "{", "Validate", ".", "isTrue", "(", "StringUtils", ".", "isNotBlank", "(", "field", ")", ",", "\"One of the specified fields was blank\"", ")", ";", "fieldList", ".", "add", "(", "field", ".", "trim", "(", ")", ")", ";", "}", "return", "fieldList", ";", "}" ]
Private helper method for setting the field names. It converts colons to underscores and removes any blanks or excess whitespace. Instances are immutable so this method cannot be made public. @param fields A non-null Iterable of field names.
[ "Private", "helper", "method", "for", "setting", "the", "field", "names", ".", "It", "converts", "colons", "to", "underscores", "and", "removes", "any", "blanks", "or", "excess", "whitespace", ".", "Instances", "are", "immutable", "so", "this", "method", "cannot", "be", "made", "public", "." ]
8d33dc633f8df2a470a571ac7694e423e7004ad0
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java#L166-L175
154,227
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java
Specifier.resolveValues
private static List<String> resolveValues(final Iterable<? extends String> values) { final List<String> valuesList = new ArrayList<String>(); for(final String value : values) { Validate.notNull(value, "One of the specified values was null"); valuesList.add(value); } return valuesList; }
java
private static List<String> resolveValues(final Iterable<? extends String> values) { final List<String> valuesList = new ArrayList<String>(); for(final String value : values) { Validate.notNull(value, "One of the specified values was null"); valuesList.add(value); } return valuesList; }
[ "private", "static", "List", "<", "String", ">", "resolveValues", "(", "final", "Iterable", "<", "?", "extends", "String", ">", "values", ")", "{", "final", "List", "<", "String", ">", "valuesList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "final", "String", "value", ":", "values", ")", "{", "Validate", ".", "notNull", "(", "value", ",", "\"One of the specified values was null\"", ")", ";", "valuesList", ".", "add", "(", "value", ")", ";", "}", "return", "valuesList", ";", "}" ]
Private helper method for setting the field values. nulls are not permitted. Instances are immutable so this method cannot be made public. @param values A non-null Iterable of field values.
[ "Private", "helper", "method", "for", "setting", "the", "field", "values", ".", "nulls", "are", "not", "permitted", ".", "Instances", "are", "immutable", "so", "this", "method", "cannot", "be", "made", "public", "." ]
8d33dc633f8df2a470a571ac7694e423e7004ad0
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java#L183-L192
154,228
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java
Specifier.getValuesString
protected String getValuesString() { final StringBuilder builder = new StringBuilder(); for(final String value : values) { builder.append(AciURLCodec.getInstance().encode(value)).append(','); } if(builder.length() > 0) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); }
java
protected String getValuesString() { final StringBuilder builder = new StringBuilder(); for(final String value : values) { builder.append(AciURLCodec.getInstance().encode(value)).append(','); } if(builder.length() > 0) { builder.deleteCharAt(builder.length() - 1); } return builder.toString(); }
[ "protected", "String", "getValuesString", "(", ")", "{", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final", "String", "value", ":", "values", ")", "{", "builder", ".", "append", "(", "AciURLCodec", ".", "getInstance", "(", ")", ".", "encode", "(", "value", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "if", "(", "builder", ".", "length", "(", ")", ">", "0", ")", "{", "builder", ".", "deleteCharAt", "(", "builder", ".", "length", "(", ")", "-", "1", ")", ";", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Accessor for the specifier's values. The values are URL encoded and separated by commas. @return The specifier's value.
[ "Accessor", "for", "the", "specifier", "s", "values", ".", "The", "values", "are", "URL", "encoded", "and", "separated", "by", "commas", "." ]
8d33dc633f8df2a470a571ac7694e423e7004ad0
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/Specifier.java#L258-L270
154,229
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.headStream
public Stream<T> headStream(T key, boolean inclusive, boolean parallel) { return StreamSupport.stream(headSpliterator(key, inclusive), parallel); }
java
public Stream<T> headStream(T key, boolean inclusive, boolean parallel) { return StreamSupport.stream(headSpliterator(key, inclusive), parallel); }
[ "public", "Stream", "<", "T", ">", "headStream", "(", "T", "key", ",", "boolean", "inclusive", ",", "boolean", "parallel", ")", "{", "return", "StreamSupport", ".", "stream", "(", "headSpliterator", "(", "key", ",", "inclusive", ")", ",", "parallel", ")", ";", "}" ]
Returns stream from start to key @param key @param inclusive @param parallel @return
[ "Returns", "stream", "from", "start", "to", "key" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L80-L83
154,230
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.tailStream
public Stream<T> tailStream(T key, boolean inclusive, boolean parallel) { return StreamSupport.stream(tailSpliterator(key, inclusive), parallel); }
java
public Stream<T> tailStream(T key, boolean inclusive, boolean parallel) { return StreamSupport.stream(tailSpliterator(key, inclusive), parallel); }
[ "public", "Stream", "<", "T", ">", "tailStream", "(", "T", "key", ",", "boolean", "inclusive", ",", "boolean", "parallel", ")", "{", "return", "StreamSupport", ".", "stream", "(", "tailSpliterator", "(", "key", ",", "inclusive", ")", ",", "parallel", ")", ";", "}" ]
Returns stream from key to end @param key @param inclusive @param parallel @return
[ "Returns", "stream", "from", "key", "to", "end" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L91-L94
154,231
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.headSpliterator
public Spliterator<T> headSpliterator(T key, boolean inclusive) { int point = point(key, !inclusive); Iterator<T> iterator = subList(0, point).iterator(); return Spliterators.spliterator(iterator, size()-point, 0); }
java
public Spliterator<T> headSpliterator(T key, boolean inclusive) { int point = point(key, !inclusive); Iterator<T> iterator = subList(0, point).iterator(); return Spliterators.spliterator(iterator, size()-point, 0); }
[ "public", "Spliterator", "<", "T", ">", "headSpliterator", "(", "T", "key", ",", "boolean", "inclusive", ")", "{", "int", "point", "=", "point", "(", "key", ",", "!", "inclusive", ")", ";", "Iterator", "<", "T", ">", "iterator", "=", "subList", "(", "0", ",", "point", ")", ".", "iterator", "(", ")", ";", "return", "Spliterators", ".", "spliterator", "(", "iterator", ",", "size", "(", ")", "-", "point", ",", "0", ")", ";", "}" ]
Returns spliterator from start to key @param key @param inclusive @return
[ "Returns", "spliterator", "from", "start", "to", "key" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L101-L106
154,232
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.headIterator
public Iterator<T> headIterator(T key, boolean inclusive) { int point = point(key, !inclusive); return subList(0, point).iterator(); }
java
public Iterator<T> headIterator(T key, boolean inclusive) { int point = point(key, !inclusive); return subList(0, point).iterator(); }
[ "public", "Iterator", "<", "T", ">", "headIterator", "(", "T", "key", ",", "boolean", "inclusive", ")", "{", "int", "point", "=", "point", "(", "key", ",", "!", "inclusive", ")", ";", "return", "subList", "(", "0", ",", "point", ")", ".", "iterator", "(", ")", ";", "}" ]
Returns iterator from start to key @param key @param inclusive @return
[ "Returns", "iterator", "from", "start", "to", "key" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L125-L129
154,233
tvesalainen/util
util/src/main/java/org/vesalainen/util/OrderedList.java
OrderedList.tailIterator
public Iterator<T> tailIterator(T key, boolean inclusive) { int point = point(key, inclusive); return subList(point, size()).iterator(); }
java
public Iterator<T> tailIterator(T key, boolean inclusive) { int point = point(key, inclusive); return subList(point, size()).iterator(); }
[ "public", "Iterator", "<", "T", ">", "tailIterator", "(", "T", "key", ",", "boolean", "inclusive", ")", "{", "int", "point", "=", "point", "(", "key", ",", "inclusive", ")", ";", "return", "subList", "(", "point", ",", "size", "(", ")", ")", ".", "iterator", "(", ")", ";", "}" ]
Returns iterator from key to end @param key @param inclusive @return
[ "Returns", "iterator", "from", "key", "to", "end" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/OrderedList.java#L136-L140
154,234
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/TimeField.java
TimeField.stringToBinary
public Object stringToBinary(String tempString) throws Exception { java.util.Date dateOld = new java.util.Date((long)this.getValue()); // Save current time return DateConverter.stringToBinary(tempString, dateOld, DBConstants.TIME_ONLY_FORMAT); }
java
public Object stringToBinary(String tempString) throws Exception { java.util.Date dateOld = new java.util.Date((long)this.getValue()); // Save current time return DateConverter.stringToBinary(tempString, dateOld, DBConstants.TIME_ONLY_FORMAT); }
[ "public", "Object", "stringToBinary", "(", "String", "tempString", ")", "throws", "Exception", "{", "java", ".", "util", ".", "Date", "dateOld", "=", "new", "java", ".", "util", ".", "Date", "(", "(", "long", ")", "this", ".", "getValue", "(", ")", ")", ";", "// Save current time", "return", "DateConverter", ".", "stringToBinary", "(", "tempString", ",", "dateOld", ",", "DBConstants", ".", "TIME_ONLY_FORMAT", ")", ";", "}" ]
Convert this string to this field's binary data format. @param tempString A string to be converted to this field's binary data. @return The physical data converted from this string (must be the raw data class).
[ "Convert", "this", "string", "to", "this", "field", "s", "binary", "data", "format", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/TimeField.java#L120-L124
154,235
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.contextInitialized
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); String propertiesConfig = context.getInitParameter(PROPERTIES_CONFIG); if(propertiesConfig == null) { propertiesConfig = PROPERTIES_CONFIG_DEFAULT; } SystemProperties config = loadConfiguration(propertiesConfig, context); addProperties(config); if(config.getFile() != null) { addPropertiesFromFile(config, context); } }
java
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); String propertiesConfig = context.getInitParameter(PROPERTIES_CONFIG); if(propertiesConfig == null) { propertiesConfig = PROPERTIES_CONFIG_DEFAULT; } SystemProperties config = loadConfiguration(propertiesConfig, context); addProperties(config); if(config.getFile() != null) { addPropertiesFromFile(config, context); } }
[ "@", "Override", "public", "void", "contextInitialized", "(", "ServletContextEvent", "sce", ")", "{", "ServletContext", "context", "=", "sce", ".", "getServletContext", "(", ")", ";", "String", "propertiesConfig", "=", "context", ".", "getInitParameter", "(", "PROPERTIES_CONFIG", ")", ";", "if", "(", "propertiesConfig", "==", "null", ")", "{", "propertiesConfig", "=", "PROPERTIES_CONFIG_DEFAULT", ";", "}", "SystemProperties", "config", "=", "loadConfiguration", "(", "propertiesConfig", ",", "context", ")", ";", "addProperties", "(", "config", ")", ";", "if", "(", "config", ".", "getFile", "(", ")", "!=", "null", ")", "{", "addPropertiesFromFile", "(", "config", ",", "context", ")", ";", "}", "}" ]
Sets properties from the context-param named system.properties.file into System.properties.
[ "Sets", "properties", "from", "the", "context", "-", "param", "named", "system", ".", "properties", ".", "file", "into", "System", ".", "properties", "." ]
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L83-L96
154,236
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.loadConfiguration
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{ InputStream inStream = null; try { inStream = getStreamForLocation(propertiesConfig, context); JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName()); return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream); } catch (FileNotFoundException e) { throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e); } catch (JAXBException e) { throw new IllegalStateException("Error while reading file: " + propertiesConfig, e); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
java
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{ InputStream inStream = null; try { inStream = getStreamForLocation(propertiesConfig, context); JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName()); return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream); } catch (FileNotFoundException e) { throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e); } catch (JAXBException e) { throw new IllegalStateException("Error while reading file: " + propertiesConfig, e); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "private", "SystemProperties", "loadConfiguration", "(", "String", "propertiesConfig", ",", "ServletContext", "context", ")", "throws", "IllegalStateException", "{", "InputStream", "inStream", "=", "null", ";", "try", "{", "inStream", "=", "getStreamForLocation", "(", "propertiesConfig", ",", "context", ")", ";", "JAXBContext", "jaxb", "=", "JAXBContext", ".", "newInstance", "(", "SystemProperties", ".", "class", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ")", ";", "return", "(", "SystemProperties", ")", "jaxb", ".", "createUnmarshaller", "(", ")", ".", "unmarshal", "(", "inStream", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find configuration file: \"", "+", "propertiesConfig", ",", "e", ")", ";", "}", "catch", "(", "JAXBException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error while reading file: \"", "+", "propertiesConfig", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "inStream", "!=", "null", ")", "{", "try", "{", "inStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}" ]
Loads and returns the configuration. @param propertiesConfig Location of the configuration XML file. @param context Servlet Context to read configuration from. @return the configuration object. @throws IllegalStateException If configuration could not be read due to missing file or invalid XML content in the configuration file.
[ "Loads", "and", "returns", "the", "configuration", "." ]
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L110-L130
154,237
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.getStreamForLocation
private InputStream getStreamForLocation(final String location, final ServletContext context) throws FileNotFoundException { String fileLocation = StringUtils.replaceVariables(location, new HashMap<String, Object>(), true); if (fileLocation.startsWith(PREFIX_FILE)) { return new FileInputStream(fileLocation.substring(PREFIX_FILE.length())); } else if (fileLocation.startsWith(PREFIX_CLASSPATH)){ return getClass().getResourceAsStream(fileLocation.substring(PREFIX_CLASSPATH.length())); } else { if (fileLocation.startsWith(PREFIX_WAR)) { fileLocation = fileLocation.substring(PREFIX_WAR.length()); } return context.getResourceAsStream(fileLocation); } }
java
private InputStream getStreamForLocation(final String location, final ServletContext context) throws FileNotFoundException { String fileLocation = StringUtils.replaceVariables(location, new HashMap<String, Object>(), true); if (fileLocation.startsWith(PREFIX_FILE)) { return new FileInputStream(fileLocation.substring(PREFIX_FILE.length())); } else if (fileLocation.startsWith(PREFIX_CLASSPATH)){ return getClass().getResourceAsStream(fileLocation.substring(PREFIX_CLASSPATH.length())); } else { if (fileLocation.startsWith(PREFIX_WAR)) { fileLocation = fileLocation.substring(PREFIX_WAR.length()); } return context.getResourceAsStream(fileLocation); } }
[ "private", "InputStream", "getStreamForLocation", "(", "final", "String", "location", ",", "final", "ServletContext", "context", ")", "throws", "FileNotFoundException", "{", "String", "fileLocation", "=", "StringUtils", ".", "replaceVariables", "(", "location", ",", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ",", "true", ")", ";", "if", "(", "fileLocation", ".", "startsWith", "(", "PREFIX_FILE", ")", ")", "{", "return", "new", "FileInputStream", "(", "fileLocation", ".", "substring", "(", "PREFIX_FILE", ".", "length", "(", ")", ")", ")", ";", "}", "else", "if", "(", "fileLocation", ".", "startsWith", "(", "PREFIX_CLASSPATH", ")", ")", "{", "return", "getClass", "(", ")", ".", "getResourceAsStream", "(", "fileLocation", ".", "substring", "(", "PREFIX_CLASSPATH", ".", "length", "(", ")", ")", ")", ";", "}", "else", "{", "if", "(", "fileLocation", ".", "startsWith", "(", "PREFIX_WAR", ")", ")", "{", "fileLocation", "=", "fileLocation", ".", "substring", "(", "PREFIX_WAR", ".", "length", "(", ")", ")", ";", "}", "return", "context", ".", "getResourceAsStream", "(", "fileLocation", ")", ";", "}", "}" ]
Returns the InputStream to the supplied file location @param location File location, may contain file:, classpath: or war: prefix. If no prefix is used war location is assumed. @param context Servlet Context to read war resources from. @throws FileNotFoundException If a file resource could not be found.
[ "Returns", "the", "InputStream", "to", "the", "supplied", "file", "location" ]
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L141-L153
154,238
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.addProperties
private void addProperties(final SystemProperties config) { for(Property property : config.getProperty()) { String name = property.getName().trim(); String value = property.getValue().trim(); if(config.isOverrideProperties() || (System.getProperty(name) == null)) { System.setProperty(name, value); } } }
java
private void addProperties(final SystemProperties config) { for(Property property : config.getProperty()) { String name = property.getName().trim(); String value = property.getValue().trim(); if(config.isOverrideProperties() || (System.getProperty(name) == null)) { System.setProperty(name, value); } } }
[ "private", "void", "addProperties", "(", "final", "SystemProperties", "config", ")", "{", "for", "(", "Property", "property", ":", "config", ".", "getProperty", "(", ")", ")", "{", "String", "name", "=", "property", ".", "getName", "(", ")", ".", "trim", "(", ")", ";", "String", "value", "=", "property", ".", "getValue", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "config", ".", "isOverrideProperties", "(", ")", "||", "(", "System", ".", "getProperty", "(", "name", ")", "==", "null", ")", ")", "{", "System", ".", "setProperty", "(", "name", ",", "value", ")", ";", "}", "}", "}" ]
Adds properties from the configuration to system properties. @param config Configuration object.
[ "Adds", "properties", "from", "the", "configuration", "to", "system", "properties", "." ]
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L160-L169
154,239
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.addPropertiesFromFile
private void addPropertiesFromFile(final SystemProperties config, final ServletContext context) { String fileLocation = StringUtils.replaceVariables(config.getFile(), new HashMap<String, Object>(), true); InputStream inStream = null; try { inStream = getStreamForLocation(fileLocation, context); Properties propsFromFile = new Properties(); propsFromFile.load(inStream); for (String prop : propsFromFile.stringPropertyNames()) { String propertyValue = propsFromFile.getProperty(prop); if (propertyValue != null && (config.isOverrideProperties() || (System.getProperty(prop) == null))) { System.setProperty(prop, propertyValue); } } } catch (FileNotFoundException e) { if (!config.isIgnoreMissingFile()) { throw new IllegalStateException("Could not find properties file: " + fileLocation, e); } } catch (IOException e) { if (!config.isIgnoreMissingFile()) { throw new IllegalStateException("Error occurred when reading properties file: " + fileLocation, e); } } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
java
private void addPropertiesFromFile(final SystemProperties config, final ServletContext context) { String fileLocation = StringUtils.replaceVariables(config.getFile(), new HashMap<String, Object>(), true); InputStream inStream = null; try { inStream = getStreamForLocation(fileLocation, context); Properties propsFromFile = new Properties(); propsFromFile.load(inStream); for (String prop : propsFromFile.stringPropertyNames()) { String propertyValue = propsFromFile.getProperty(prop); if (propertyValue != null && (config.isOverrideProperties() || (System.getProperty(prop) == null))) { System.setProperty(prop, propertyValue); } } } catch (FileNotFoundException e) { if (!config.isIgnoreMissingFile()) { throw new IllegalStateException("Could not find properties file: " + fileLocation, e); } } catch (IOException e) { if (!config.isIgnoreMissingFile()) { throw new IllegalStateException("Error occurred when reading properties file: " + fileLocation, e); } } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "private", "void", "addPropertiesFromFile", "(", "final", "SystemProperties", "config", ",", "final", "ServletContext", "context", ")", "{", "String", "fileLocation", "=", "StringUtils", ".", "replaceVariables", "(", "config", ".", "getFile", "(", ")", ",", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ",", "true", ")", ";", "InputStream", "inStream", "=", "null", ";", "try", "{", "inStream", "=", "getStreamForLocation", "(", "fileLocation", ",", "context", ")", ";", "Properties", "propsFromFile", "=", "new", "Properties", "(", ")", ";", "propsFromFile", ".", "load", "(", "inStream", ")", ";", "for", "(", "String", "prop", ":", "propsFromFile", ".", "stringPropertyNames", "(", ")", ")", "{", "String", "propertyValue", "=", "propsFromFile", ".", "getProperty", "(", "prop", ")", ";", "if", "(", "propertyValue", "!=", "null", "&&", "(", "config", ".", "isOverrideProperties", "(", ")", "||", "(", "System", ".", "getProperty", "(", "prop", ")", "==", "null", ")", ")", ")", "{", "System", ".", "setProperty", "(", "prop", ",", "propertyValue", ")", ";", "}", "}", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "if", "(", "!", "config", ".", "isIgnoreMissingFile", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find properties file: \"", "+", "fileLocation", ",", "e", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "if", "(", "!", "config", ".", "isIgnoreMissingFile", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error occurred when reading properties file: \"", "+", "fileLocation", ",", "e", ")", ";", "}", "}", "finally", "{", "if", "(", "inStream", "!=", "null", ")", "{", "try", "{", "inStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}" ]
Adds properties from the properties file configured in the configuration object. @param config Configuration object.
[ "Adds", "properties", "from", "the", "properties", "file", "configured", "in", "the", "configuration", "object", "." ]
bb6d8eacbefdeb7c8c6bb6135e55939d968fa433
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L176-L206
154,240
jbundle/jbundle
base/screen/control/xslservlet/src/main/java/org/jbundle/base/screen/control/xslservlet/XSLServlet.java
XSLServlet.getTransformer
public Transformer getTransformer(HttpServletRequest req, ServletTask servletTask, ScreenModel screen) throws ServletException, IOException { String stylesheet = null; if (stylesheet == null) stylesheet = req.getParameter(DBParams.TEMPLATE); if (stylesheet == null) if (screen != null) if (screen.getScreenFieldView() != null) stylesheet = screen.getScreenFieldView().getStylesheetPath(); if (stylesheet == null) stylesheet = req.getParameter("stylesheet"); if (stylesheet == null) stylesheet = "org/jbundle/res/docs/styles/xsl/flat/base/menus"; try { if (hmTransformers.get(stylesheet) != null) return hmTransformers.get(stylesheet); String stylesheetFixed = BaseServlet.fixStylesheetPath(stylesheet, screen, true); InputStream stylesheetStream = this.getFileStream(servletTask, stylesheetFixed, null); if (stylesheetStream == null) { stylesheetFixed = BaseServlet.fixStylesheetPath(stylesheet, screen, false); // Try it without browser mod stylesheetStream = this.getFileStream(servletTask, stylesheetFixed, null); } if (stylesheetStream == null) Utility.getLogger().warning("XmlFile not found " + stylesheetFixed); // TODO - Display an error here StreamSource stylesheetSource = new StreamSource(stylesheetStream); if (tFact == null) tFact = TransformerFactory.newInstance(); URIResolver resolver = new MyURIResolver(servletTask, stylesheetFixed); tFact.setURIResolver(resolver); Transformer transformer = tFact.newTransformer(stylesheetSource); //transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //transformer.setOutputProperty(OutputKeys.METHOD, "xml"); hmTransformers.put(stylesheet, transformer); return transformer; } catch (TransformerConfigurationException ex) { ex.printStackTrace(); } return null; }
java
public Transformer getTransformer(HttpServletRequest req, ServletTask servletTask, ScreenModel screen) throws ServletException, IOException { String stylesheet = null; if (stylesheet == null) stylesheet = req.getParameter(DBParams.TEMPLATE); if (stylesheet == null) if (screen != null) if (screen.getScreenFieldView() != null) stylesheet = screen.getScreenFieldView().getStylesheetPath(); if (stylesheet == null) stylesheet = req.getParameter("stylesheet"); if (stylesheet == null) stylesheet = "org/jbundle/res/docs/styles/xsl/flat/base/menus"; try { if (hmTransformers.get(stylesheet) != null) return hmTransformers.get(stylesheet); String stylesheetFixed = BaseServlet.fixStylesheetPath(stylesheet, screen, true); InputStream stylesheetStream = this.getFileStream(servletTask, stylesheetFixed, null); if (stylesheetStream == null) { stylesheetFixed = BaseServlet.fixStylesheetPath(stylesheet, screen, false); // Try it without browser mod stylesheetStream = this.getFileStream(servletTask, stylesheetFixed, null); } if (stylesheetStream == null) Utility.getLogger().warning("XmlFile not found " + stylesheetFixed); // TODO - Display an error here StreamSource stylesheetSource = new StreamSource(stylesheetStream); if (tFact == null) tFact = TransformerFactory.newInstance(); URIResolver resolver = new MyURIResolver(servletTask, stylesheetFixed); tFact.setURIResolver(resolver); Transformer transformer = tFact.newTransformer(stylesheetSource); //transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //transformer.setOutputProperty(OutputKeys.METHOD, "xml"); hmTransformers.put(stylesheet, transformer); return transformer; } catch (TransformerConfigurationException ex) { ex.printStackTrace(); } return null; }
[ "public", "Transformer", "getTransformer", "(", "HttpServletRequest", "req", ",", "ServletTask", "servletTask", ",", "ScreenModel", "screen", ")", "throws", "ServletException", ",", "IOException", "{", "String", "stylesheet", "=", "null", ";", "if", "(", "stylesheet", "==", "null", ")", "stylesheet", "=", "req", ".", "getParameter", "(", "DBParams", ".", "TEMPLATE", ")", ";", "if", "(", "stylesheet", "==", "null", ")", "if", "(", "screen", "!=", "null", ")", "if", "(", "screen", ".", "getScreenFieldView", "(", ")", "!=", "null", ")", "stylesheet", "=", "screen", ".", "getScreenFieldView", "(", ")", ".", "getStylesheetPath", "(", ")", ";", "if", "(", "stylesheet", "==", "null", ")", "stylesheet", "=", "req", ".", "getParameter", "(", "\"stylesheet\"", ")", ";", "if", "(", "stylesheet", "==", "null", ")", "stylesheet", "=", "\"org/jbundle/res/docs/styles/xsl/flat/base/menus\"", ";", "try", "{", "if", "(", "hmTransformers", ".", "get", "(", "stylesheet", ")", "!=", "null", ")", "return", "hmTransformers", ".", "get", "(", "stylesheet", ")", ";", "String", "stylesheetFixed", "=", "BaseServlet", ".", "fixStylesheetPath", "(", "stylesheet", ",", "screen", ",", "true", ")", ";", "InputStream", "stylesheetStream", "=", "this", ".", "getFileStream", "(", "servletTask", ",", "stylesheetFixed", ",", "null", ")", ";", "if", "(", "stylesheetStream", "==", "null", ")", "{", "stylesheetFixed", "=", "BaseServlet", ".", "fixStylesheetPath", "(", "stylesheet", ",", "screen", ",", "false", ")", ";", "// Try it without browser mod", "stylesheetStream", "=", "this", ".", "getFileStream", "(", "servletTask", ",", "stylesheetFixed", ",", "null", ")", ";", "}", "if", "(", "stylesheetStream", "==", "null", ")", "Utility", ".", "getLogger", "(", ")", ".", "warning", "(", "\"XmlFile not found \"", "+", "stylesheetFixed", ")", ";", "// TODO - Display an error here", "StreamSource", "stylesheetSource", "=", "new", "StreamSource", "(", "stylesheetStream", ")", ";", "if", "(", "tFact", "==", "null", ")", "tFact", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "URIResolver", "resolver", "=", "new", "MyURIResolver", "(", "servletTask", ",", "stylesheetFixed", ")", ";", "tFact", ".", "setURIResolver", "(", "resolver", ")", ";", "Transformer", "transformer", "=", "tFact", ".", "newTransformer", "(", "stylesheetSource", ")", ";", "//transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");", "//transformer.setOutputProperty(OutputKeys.METHOD, \"xml\");", "hmTransformers", ".", "put", "(", "stylesheet", ",", "transformer", ")", ";", "return", "transformer", ";", "}", "catch", "(", "TransformerConfigurationException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Get or Create a transformer for the specified stylesheet. @param req @param servletTask @param screen @return @throws ServletException @throws IOException
[ "Get", "or", "Create", "a", "transformer", "for", "the", "specified", "stylesheet", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/xslservlet/src/main/java/org/jbundle/base/screen/control/xslservlet/XSLServlet.java#L189-L232
154,241
tvesalainen/util
util/src/main/java/org/vesalainen/util/ArrayHelp.java
ArrayHelp.sort
public static void sort(double[] data, int rowLength) { quickSort(data, 0, (data.length - 1)/rowLength, rowLength, NATURAL_ROW_COMPARATOR, new double[rowLength], new double[rowLength]); }
java
public static void sort(double[] data, int rowLength) { quickSort(data, 0, (data.length - 1)/rowLength, rowLength, NATURAL_ROW_COMPARATOR, new double[rowLength], new double[rowLength]); }
[ "public", "static", "void", "sort", "(", "double", "[", "]", "data", ",", "int", "rowLength", ")", "{", "quickSort", "(", "data", ",", "0", ",", "(", "data", ".", "length", "-", "1", ")", "/", "rowLength", ",", "rowLength", ",", "NATURAL_ROW_COMPARATOR", ",", "new", "double", "[", "rowLength", "]", ",", "new", "double", "[", "rowLength", "]", ")", ";", "}" ]
Sorts rows in 1D array in ascending order comparing each rows column. @param data @param rowLength
[ "Sorts", "rows", "in", "1D", "array", "in", "ascending", "order", "comparing", "each", "rows", "column", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L34-L37
154,242
tvesalainen/util
util/src/main/java/org/vesalainen/util/ArrayHelp.java
ArrayHelp.contains
public static final <T> boolean contains(T[] array, T item) { for (T b : array) { if (b.equals(item)) { return true; } } return false; }
java
public static final <T> boolean contains(T[] array, T item) { for (T b : array) { if (b.equals(item)) { return true; } } return false; }
[ "public", "static", "final", "<", "T", ">", "boolean", "contains", "(", "T", "[", "]", "array", ",", "T", "item", ")", "{", "for", "(", "T", "b", ":", "array", ")", "{", "if", "(", "b", ".", "equals", "(", "item", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if one of arr members equals item @param <T> @param array @param item @return
[ "Returns", "true", "if", "one", "of", "arr", "members", "equals", "item" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L374-L384
154,243
tvesalainen/util
util/src/main/java/org/vesalainen/util/ArrayHelp.java
ArrayHelp.containsOnly
public static final <T> boolean containsOnly(short[] array, T... items) { for (short b : array) { if (!contains(items, b)) { return false; } } return true; }
java
public static final <T> boolean containsOnly(short[] array, T... items) { for (short b : array) { if (!contains(items, b)) { return false; } } return true; }
[ "public", "static", "final", "<", "T", ">", "boolean", "containsOnly", "(", "short", "[", "]", "array", ",", "T", "...", "items", ")", "{", "for", "(", "short", "b", ":", "array", ")", "{", "if", "(", "!", "contains", "(", "items", ",", "b", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Throws UnsupportedOperationException if one of array members is not one of items @param <T> @param array @param items @return
[ "Throws", "UnsupportedOperationException", "if", "one", "of", "array", "members", "is", "not", "one", "of", "items" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ArrayHelp.java#L450-L460
154,244
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/metadata/CatalogMetadataBuilder.java
CatalogMetadataBuilder.withTables
@TimerJ public CatalogMetadataBuilder withTables(TableMetadata... tableMetadataList) { for (TableMetadata tableMetadata : tableMetadataList) { tables.put(tableMetadata.getName(), tableMetadata); } return this; }
java
@TimerJ public CatalogMetadataBuilder withTables(TableMetadata... tableMetadataList) { for (TableMetadata tableMetadata : tableMetadataList) { tables.put(tableMetadata.getName(), tableMetadata); } return this; }
[ "@", "TimerJ", "public", "CatalogMetadataBuilder", "withTables", "(", "TableMetadata", "...", "tableMetadataList", ")", "{", "for", "(", "TableMetadata", "tableMetadata", ":", "tableMetadataList", ")", "{", "tables", ".", "put", "(", "tableMetadata", ".", "getName", "(", ")", ",", "tableMetadata", ")", ";", "}", "return", "this", ";", "}" ]
Adds tables to the catalog. @param tableMetadataList the table metadata list @return the catalog metadata builder
[ "Adds", "tables", "to", "the", "catalog", "." ]
d7cc66cb9591344a13055962e87a91f01c3707d1
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/metadata/CatalogMetadataBuilder.java#L68-L74
154,245
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.getQueueType
public String getQueueType(boolean bDefaultIfNone) { String strQueueType = null; Record recQueueName = ((ReferenceField)this.getField(MessageProcessInfo.QUEUE_NAME_ID)).getReference(); if (recQueueName != null) if (recQueueName.getEditMode() == DBConstants.EDIT_CURRENT) strQueueType = recQueueName.getField(QueueName.QUEUE_TYPE).toString(); if ((strQueueType == null) || (strQueueType.length() == 0)) if (bDefaultIfNone) strQueueType = MessageConstants.DEFAULT_QUEUE; return strQueueType; }
java
public String getQueueType(boolean bDefaultIfNone) { String strQueueType = null; Record recQueueName = ((ReferenceField)this.getField(MessageProcessInfo.QUEUE_NAME_ID)).getReference(); if (recQueueName != null) if (recQueueName.getEditMode() == DBConstants.EDIT_CURRENT) strQueueType = recQueueName.getField(QueueName.QUEUE_TYPE).toString(); if ((strQueueType == null) || (strQueueType.length() == 0)) if (bDefaultIfNone) strQueueType = MessageConstants.DEFAULT_QUEUE; return strQueueType; }
[ "public", "String", "getQueueType", "(", "boolean", "bDefaultIfNone", ")", "{", "String", "strQueueType", "=", "null", ";", "Record", "recQueueName", "=", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "QUEUE_NAME_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recQueueName", "!=", "null", ")", "if", "(", "recQueueName", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_CURRENT", ")", "strQueueType", "=", "recQueueName", ".", "getField", "(", "QueueName", ".", "QUEUE_TYPE", ")", ".", "toString", "(", ")", ";", "if", "(", "(", "strQueueType", "==", "null", ")", "||", "(", "strQueueType", ".", "length", "(", ")", "==", "0", ")", ")", "if", "(", "bDefaultIfNone", ")", "strQueueType", "=", "MessageConstants", ".", "DEFAULT_QUEUE", ";", "return", "strQueueType", ";", "}" ]
Get the queue type for this message process.
[ "Get", "the", "queue", "type", "for", "this", "message", "process", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L238-L249
154,246
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.setupMessageHeaderFromCode
public boolean setupMessageHeaderFromCode(Message trxMessage, String strMessageCode, String strVersion) { TrxMessageHeader trxMessageHeader = (TrxMessageHeader)((BaseMessage)trxMessage).getMessageHeader(); if ((trxMessageHeader == null) && (strMessageCode == null)) return false; if (trxMessageHeader == null) { trxMessageHeader = new TrxMessageHeader(null, null); ((BaseMessage)trxMessage).setMessageHeader(trxMessageHeader); } if (strMessageCode == null) strMessageCode = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_CODE); Utility.getLogger().info("Message code: " + strMessageCode); if (strMessageCode == null) return false; // Message not found MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(strMessageCode); if (recMessageProcessInfo == null) return false; // Message not found MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo == null) return false; // Impossible trxMessageHeader = recMessageInfo.addMessageProperties(trxMessageHeader); trxMessageHeader = this.addMessageProperties(trxMessageHeader); trxMessageHeader = this.addTransportProperties(trxMessageHeader, strVersion); return true; }
java
public boolean setupMessageHeaderFromCode(Message trxMessage, String strMessageCode, String strVersion) { TrxMessageHeader trxMessageHeader = (TrxMessageHeader)((BaseMessage)trxMessage).getMessageHeader(); if ((trxMessageHeader == null) && (strMessageCode == null)) return false; if (trxMessageHeader == null) { trxMessageHeader = new TrxMessageHeader(null, null); ((BaseMessage)trxMessage).setMessageHeader(trxMessageHeader); } if (strMessageCode == null) strMessageCode = (String)trxMessageHeader.get(TrxMessageHeader.MESSAGE_CODE); Utility.getLogger().info("Message code: " + strMessageCode); if (strMessageCode == null) return false; // Message not found MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(strMessageCode); if (recMessageProcessInfo == null) return false; // Message not found MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); if (recMessageInfo == null) return false; // Impossible trxMessageHeader = recMessageInfo.addMessageProperties(trxMessageHeader); trxMessageHeader = this.addMessageProperties(trxMessageHeader); trxMessageHeader = this.addTransportProperties(trxMessageHeader, strVersion); return true; }
[ "public", "boolean", "setupMessageHeaderFromCode", "(", "Message", "trxMessage", ",", "String", "strMessageCode", ",", "String", "strVersion", ")", "{", "TrxMessageHeader", "trxMessageHeader", "=", "(", "TrxMessageHeader", ")", "(", "(", "BaseMessage", ")", "trxMessage", ")", ".", "getMessageHeader", "(", ")", ";", "if", "(", "(", "trxMessageHeader", "==", "null", ")", "&&", "(", "strMessageCode", "==", "null", ")", ")", "return", "false", ";", "if", "(", "trxMessageHeader", "==", "null", ")", "{", "trxMessageHeader", "=", "new", "TrxMessageHeader", "(", "null", ",", "null", ")", ";", "(", "(", "BaseMessage", ")", "trxMessage", ")", ".", "setMessageHeader", "(", "trxMessageHeader", ")", ";", "}", "if", "(", "strMessageCode", "==", "null", ")", "strMessageCode", "=", "(", "String", ")", "trxMessageHeader", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_CODE", ")", ";", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Message code: \"", "+", "strMessageCode", ")", ";", "if", "(", "strMessageCode", "==", "null", ")", "return", "false", ";", "// Message not found", "MessageProcessInfo", "recMessageProcessInfo", "=", "(", "MessageProcessInfo", ")", "this", ".", "getMessageProcessInfo", "(", "strMessageCode", ")", ";", "if", "(", "recMessageProcessInfo", "==", "null", ")", "return", "false", ";", "// Message not found", "MessageInfo", "recMessageInfo", "=", "(", "MessageInfo", ")", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageInfo", "==", "null", ")", "return", "false", ";", "// Impossible", "trxMessageHeader", "=", "recMessageInfo", ".", "addMessageProperties", "(", "trxMessageHeader", ")", ";", "trxMessageHeader", "=", "this", ".", "addMessageProperties", "(", "trxMessageHeader", ")", ";", "trxMessageHeader", "=", "this", ".", "addTransportProperties", "(", "trxMessageHeader", ",", "strVersion", ")", ";", "return", "true", ";", "}" ]
SetupMessageHeaderFromCode Method.
[ "SetupMessageHeaderFromCode", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L354-L380
154,247
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.getMessageControl
public MessageControl getMessageControl() { if (m_recMessageControl == null) { RecordOwner recordOwner = this.findRecordOwner(); m_recMessageControl = new MessageControl(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recMessageControl); // Set it is not on the recordowner's list this.addListener(new FreeOnFreeHandler(m_recMessageControl)); } return m_recMessageControl; }
java
public MessageControl getMessageControl() { if (m_recMessageControl == null) { RecordOwner recordOwner = this.findRecordOwner(); m_recMessageControl = new MessageControl(recordOwner); if (recordOwner != null) recordOwner.removeRecord(m_recMessageControl); // Set it is not on the recordowner's list this.addListener(new FreeOnFreeHandler(m_recMessageControl)); } return m_recMessageControl; }
[ "public", "MessageControl", "getMessageControl", "(", ")", "{", "if", "(", "m_recMessageControl", "==", "null", ")", "{", "RecordOwner", "recordOwner", "=", "this", ".", "findRecordOwner", "(", ")", ";", "m_recMessageControl", "=", "new", "MessageControl", "(", "recordOwner", ")", ";", "if", "(", "recordOwner", "!=", "null", ")", "recordOwner", ".", "removeRecord", "(", "m_recMessageControl", ")", ";", "// Set it is not on the recordowner's list", "this", ".", "addListener", "(", "new", "FreeOnFreeHandler", "(", "m_recMessageControl", ")", ")", ";", "}", "return", "m_recMessageControl", ";", "}" ]
GetMessageControl Method.
[ "GetMessageControl", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L499-L510
154,248
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.addMessageProperties
public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader) { Map<String,Object> mapHeaderMessageInfo = trxMessageHeader.getMessageInfoMap(); Map<String,Object> propMessageProcessInfo = ((PropertiesField)this.getField(MessageProcessInfo.PROPERTIES)).loadProperties(); String strQueueName = this.getQueueName(false); if (propMessageProcessInfo.get(MessageConstants.QUEUE_NAME) == null) if (strQueueName != null) propMessageProcessInfo.put(MessageConstants.QUEUE_NAME, strQueueName); String strQueueType = this.getQueueType(false); if (propMessageProcessInfo.get(MessageConstants.QUEUE_TYPE) == null) if (strQueueType != null) propMessageProcessInfo.put(MessageConstants.QUEUE_TYPE, strQueueType); if (!this.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID).isNull()) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_RESPONSE_ID, this.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID).toString()); if (!this.getField(MessageProcessInfo.LOCAL_MESSAGE_PROCESS_INFO_ID).isNull()) propMessageProcessInfo.put(LocalMessageTransport.LOCAL_PROCESSOR, this.getField(MessageProcessInfo.LOCAL_MESSAGE_PROCESS_INFO_ID).toString()); if (!this.getField(MessageProcessInfo.MESSAGE_TYPE_ID).isNull()) { MessageType recMessageType = (MessageType)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference(); if (recMessageType != null) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, recMessageType.getField(MessageType.CODE).toString()); } if (!this.getField(MessageProcessInfo.PROCESSOR_CLASS).isNull()) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS, this.getField(MessageProcessInfo.PROCESSOR_CLASS).toString()); if (mapHeaderMessageInfo != null) mapHeaderMessageInfo.putAll(propMessageProcessInfo); else mapHeaderMessageInfo = propMessageProcessInfo; if (mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS) == null) this.setDefaultMessageProcessor(mapHeaderMessageInfo); trxMessageHeader.setMessageInfoMap(mapHeaderMessageInfo); trxMessageHeader.put(TrxMessageHeader.MESSAGE_PROCESS_INFO_ID, this.getCounterField().toString()); String strDescription = this.getField(MessageProcessInfo.DESCRIPTION).toString(); if (((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference() != null) if (!((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference().getField(MessageInfo.DESCRIPTION).isNull()) strDescription = ((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference().getField(MessageInfo.DESCRIPTION).toString(); trxMessageHeader.put(TrxMessageHeader.DESCRIPTION, strDescription); return trxMessageHeader; }
java
public TrxMessageHeader addMessageProperties(TrxMessageHeader trxMessageHeader) { Map<String,Object> mapHeaderMessageInfo = trxMessageHeader.getMessageInfoMap(); Map<String,Object> propMessageProcessInfo = ((PropertiesField)this.getField(MessageProcessInfo.PROPERTIES)).loadProperties(); String strQueueName = this.getQueueName(false); if (propMessageProcessInfo.get(MessageConstants.QUEUE_NAME) == null) if (strQueueName != null) propMessageProcessInfo.put(MessageConstants.QUEUE_NAME, strQueueName); String strQueueType = this.getQueueType(false); if (propMessageProcessInfo.get(MessageConstants.QUEUE_TYPE) == null) if (strQueueType != null) propMessageProcessInfo.put(MessageConstants.QUEUE_TYPE, strQueueType); if (!this.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID).isNull()) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_RESPONSE_ID, this.getField(MessageProcessInfo.REPLY_MESSAGE_PROCESS_INFO_ID).toString()); if (!this.getField(MessageProcessInfo.LOCAL_MESSAGE_PROCESS_INFO_ID).isNull()) propMessageProcessInfo.put(LocalMessageTransport.LOCAL_PROCESSOR, this.getField(MessageProcessInfo.LOCAL_MESSAGE_PROCESS_INFO_ID).toString()); if (!this.getField(MessageProcessInfo.MESSAGE_TYPE_ID).isNull()) { MessageType recMessageType = (MessageType)((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_TYPE_ID)).getReference(); if (recMessageType != null) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_PROCESS_TYPE, recMessageType.getField(MessageType.CODE).toString()); } if (!this.getField(MessageProcessInfo.PROCESSOR_CLASS).isNull()) propMessageProcessInfo.put(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS, this.getField(MessageProcessInfo.PROCESSOR_CLASS).toString()); if (mapHeaderMessageInfo != null) mapHeaderMessageInfo.putAll(propMessageProcessInfo); else mapHeaderMessageInfo = propMessageProcessInfo; if (mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS) == null) this.setDefaultMessageProcessor(mapHeaderMessageInfo); trxMessageHeader.setMessageInfoMap(mapHeaderMessageInfo); trxMessageHeader.put(TrxMessageHeader.MESSAGE_PROCESS_INFO_ID, this.getCounterField().toString()); String strDescription = this.getField(MessageProcessInfo.DESCRIPTION).toString(); if (((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference() != null) if (!((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference().getField(MessageInfo.DESCRIPTION).isNull()) strDescription = ((ReferenceField)this.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference().getField(MessageInfo.DESCRIPTION).toString(); trxMessageHeader.put(TrxMessageHeader.DESCRIPTION, strDescription); return trxMessageHeader; }
[ "public", "TrxMessageHeader", "addMessageProperties", "(", "TrxMessageHeader", "trxMessageHeader", ")", "{", "Map", "<", "String", ",", "Object", ">", "mapHeaderMessageInfo", "=", "trxMessageHeader", ".", "getMessageInfoMap", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "propMessageProcessInfo", "=", "(", "(", "PropertiesField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "PROPERTIES", ")", ")", ".", "loadProperties", "(", ")", ";", "String", "strQueueName", "=", "this", ".", "getQueueName", "(", "false", ")", ";", "if", "(", "propMessageProcessInfo", ".", "get", "(", "MessageConstants", ".", "QUEUE_NAME", ")", "==", "null", ")", "if", "(", "strQueueName", "!=", "null", ")", "propMessageProcessInfo", ".", "put", "(", "MessageConstants", ".", "QUEUE_NAME", ",", "strQueueName", ")", ";", "String", "strQueueType", "=", "this", ".", "getQueueType", "(", "false", ")", ";", "if", "(", "propMessageProcessInfo", ".", "get", "(", "MessageConstants", ".", "QUEUE_TYPE", ")", "==", "null", ")", "if", "(", "strQueueType", "!=", "null", ")", "propMessageProcessInfo", ".", "put", "(", "MessageConstants", ".", "QUEUE_TYPE", ",", "strQueueType", ")", ";", "if", "(", "!", "this", ".", "getField", "(", "MessageProcessInfo", ".", "REPLY_MESSAGE_PROCESS_INFO_ID", ")", ".", "isNull", "(", ")", ")", "propMessageProcessInfo", ".", "put", "(", "TrxMessageHeader", ".", "MESSAGE_RESPONSE_ID", ",", "this", ".", "getField", "(", "MessageProcessInfo", ".", "REPLY_MESSAGE_PROCESS_INFO_ID", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "this", ".", "getField", "(", "MessageProcessInfo", ".", "LOCAL_MESSAGE_PROCESS_INFO_ID", ")", ".", "isNull", "(", ")", ")", "propMessageProcessInfo", ".", "put", "(", "LocalMessageTransport", ".", "LOCAL_PROCESSOR", ",", "this", ".", "getField", "(", "MessageProcessInfo", ".", "LOCAL_MESSAGE_PROCESS_INFO_ID", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "!", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_TYPE_ID", ")", ".", "isNull", "(", ")", ")", "{", "MessageType", "recMessageType", "=", "(", "MessageType", ")", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_TYPE_ID", ")", ")", ".", "getReference", "(", ")", ";", "if", "(", "recMessageType", "!=", "null", ")", "propMessageProcessInfo", ".", "put", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESS_TYPE", ",", "recMessageType", ".", "getField", "(", "MessageType", ".", "CODE", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "!", "this", ".", "getField", "(", "MessageProcessInfo", ".", "PROCESSOR_CLASS", ")", ".", "isNull", "(", ")", ")", "propMessageProcessInfo", ".", "put", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESSOR_CLASS", ",", "this", ".", "getField", "(", "MessageProcessInfo", ".", "PROCESSOR_CLASS", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "mapHeaderMessageInfo", "!=", "null", ")", "mapHeaderMessageInfo", ".", "putAll", "(", "propMessageProcessInfo", ")", ";", "else", "mapHeaderMessageInfo", "=", "propMessageProcessInfo", ";", "if", "(", "mapHeaderMessageInfo", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESSOR_CLASS", ")", "==", "null", ")", "this", ".", "setDefaultMessageProcessor", "(", "mapHeaderMessageInfo", ")", ";", "trxMessageHeader", ".", "setMessageInfoMap", "(", "mapHeaderMessageInfo", ")", ";", "trxMessageHeader", ".", "put", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESS_INFO_ID", ",", "this", ".", "getCounterField", "(", ")", ".", "toString", "(", ")", ")", ";", "String", "strDescription", "=", "this", ".", "getField", "(", "MessageProcessInfo", ".", "DESCRIPTION", ")", ".", "toString", "(", ")", ";", "if", "(", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", "!=", "null", ")", "if", "(", "!", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ".", "getField", "(", "MessageInfo", ".", "DESCRIPTION", ")", ".", "isNull", "(", ")", ")", "strDescription", "=", "(", "(", "ReferenceField", ")", "this", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ".", "getField", "(", "MessageInfo", ".", "DESCRIPTION", ")", ".", "toString", "(", ")", ";", "trxMessageHeader", ".", "put", "(", "TrxMessageHeader", ".", "DESCRIPTION", ",", "strDescription", ")", ";", "return", "trxMessageHeader", ";", "}" ]
AddMessageProperties Method.
[ "AddMessageProperties", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L514-L557
154,249
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.setDefaultMessageProcessor
public void setDefaultMessageProcessor(Map<String,Object> mapHeaderMessageInfo) { if (mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS) == null) { String strMessageInfoTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_INFO_TYPE); String strMessageProcessTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESS_TYPE); if ((strMessageInfoTypeCode != null) && (strMessageProcessTypeCode != null)) { String strProcessorClass = null; if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageOutProcessor.class.getName(); else if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageInProcessor.class.getName(); else if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageReplyOutProcessor.class.getName(); if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageReplyInProcessor.class.getName(); if (strProcessorClass != null) mapHeaderMessageInfo.put(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS, strProcessorClass); } } }
java
public void setDefaultMessageProcessor(Map<String,Object> mapHeaderMessageInfo) { if (mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS) == null) { String strMessageInfoTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_INFO_TYPE); String strMessageProcessTypeCode = (String)mapHeaderMessageInfo.get(TrxMessageHeader.MESSAGE_PROCESS_TYPE); if ((strMessageInfoTypeCode != null) && (strMessageProcessTypeCode != null)) { String strProcessorClass = null; if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageOutProcessor.class.getName(); else if ((MessageInfoType.REQUEST.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageInProcessor.class.getName(); else if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_OUT.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageReplyOutProcessor.class.getName(); if ((MessageInfoType.REPLY.equals(strMessageInfoTypeCode)) && (MessageType.MESSAGE_IN.equals(strMessageProcessTypeCode))) strProcessorClass = BaseMessageReplyInProcessor.class.getName(); if (strProcessorClass != null) mapHeaderMessageInfo.put(TrxMessageHeader.MESSAGE_PROCESSOR_CLASS, strProcessorClass); } } }
[ "public", "void", "setDefaultMessageProcessor", "(", "Map", "<", "String", ",", "Object", ">", "mapHeaderMessageInfo", ")", "{", "if", "(", "mapHeaderMessageInfo", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESSOR_CLASS", ")", "==", "null", ")", "{", "String", "strMessageInfoTypeCode", "=", "(", "String", ")", "mapHeaderMessageInfo", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_INFO_TYPE", ")", ";", "String", "strMessageProcessTypeCode", "=", "(", "String", ")", "mapHeaderMessageInfo", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESS_TYPE", ")", ";", "if", "(", "(", "strMessageInfoTypeCode", "!=", "null", ")", "&&", "(", "strMessageProcessTypeCode", "!=", "null", ")", ")", "{", "String", "strProcessorClass", "=", "null", ";", "if", "(", "(", "MessageInfoType", ".", "REQUEST", ".", "equals", "(", "strMessageInfoTypeCode", ")", ")", "&&", "(", "MessageType", ".", "MESSAGE_OUT", ".", "equals", "(", "strMessageProcessTypeCode", ")", ")", ")", "strProcessorClass", "=", "BaseMessageOutProcessor", ".", "class", ".", "getName", "(", ")", ";", "else", "if", "(", "(", "MessageInfoType", ".", "REQUEST", ".", "equals", "(", "strMessageInfoTypeCode", ")", ")", "&&", "(", "MessageType", ".", "MESSAGE_IN", ".", "equals", "(", "strMessageProcessTypeCode", ")", ")", ")", "strProcessorClass", "=", "BaseMessageInProcessor", ".", "class", ".", "getName", "(", ")", ";", "else", "if", "(", "(", "MessageInfoType", ".", "REPLY", ".", "equals", "(", "strMessageInfoTypeCode", ")", ")", "&&", "(", "MessageType", ".", "MESSAGE_OUT", ".", "equals", "(", "strMessageProcessTypeCode", ")", ")", ")", "strProcessorClass", "=", "BaseMessageReplyOutProcessor", ".", "class", ".", "getName", "(", ")", ";", "if", "(", "(", "MessageInfoType", ".", "REPLY", ".", "equals", "(", "strMessageInfoTypeCode", ")", ")", "&&", "(", "MessageType", ".", "MESSAGE_IN", ".", "equals", "(", "strMessageProcessTypeCode", ")", ")", ")", "strProcessorClass", "=", "BaseMessageReplyInProcessor", ".", "class", ".", "getName", "(", ")", ";", "if", "(", "strProcessorClass", "!=", "null", ")", "mapHeaderMessageInfo", ".", "put", "(", "TrxMessageHeader", ".", "MESSAGE_PROCESSOR_CLASS", ",", "strProcessorClass", ")", ";", "}", "}", "}" ]
et the default processor if one is not specified.
[ "et", "the", "default", "processor", "if", "one", "is", "not", "specified", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L682-L703
154,250
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java
MessageProcessInfo.createReplyMessage
public Message createReplyMessage(Message message) { Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
java
public Message createReplyMessage(Message message) { Object objResponseID = ((BaseMessage)message).getMessageHeader().get(TrxMessageHeader.MESSAGE_RESPONSE_ID); if (objResponseID == null) return null; // TODO (don) FIX this - return an error. MessageProcessInfo recMessageProcessInfo = (MessageProcessInfo)this.getMessageProcessInfo(objResponseID.toString()); MessageInfo recMessageInfo = (MessageInfo)((ReferenceField)recMessageProcessInfo.getField(MessageProcessInfo.MESSAGE_INFO_ID)).getReference(); BaseMessage replyMessage = new TreeMessage(null, null); MessageRecordDesc messageRecordDesc = recMessageInfo.createNewMessage(replyMessage, null); return replyMessage; }
[ "public", "Message", "createReplyMessage", "(", "Message", "message", ")", "{", "Object", "objResponseID", "=", "(", "(", "BaseMessage", ")", "message", ")", ".", "getMessageHeader", "(", ")", ".", "get", "(", "TrxMessageHeader", ".", "MESSAGE_RESPONSE_ID", ")", ";", "if", "(", "objResponseID", "==", "null", ")", "return", "null", ";", "// TODO (don) FIX this - return an error.", "MessageProcessInfo", "recMessageProcessInfo", "=", "(", "MessageProcessInfo", ")", "this", ".", "getMessageProcessInfo", "(", "objResponseID", ".", "toString", "(", ")", ")", ";", "MessageInfo", "recMessageInfo", "=", "(", "MessageInfo", ")", "(", "(", "ReferenceField", ")", "recMessageProcessInfo", ".", "getField", "(", "MessageProcessInfo", ".", "MESSAGE_INFO_ID", ")", ")", ".", "getReference", "(", ")", ";", "BaseMessage", "replyMessage", "=", "new", "TreeMessage", "(", "null", ",", "null", ")", ";", "MessageRecordDesc", "messageRecordDesc", "=", "recMessageInfo", ".", "createNewMessage", "(", "replyMessage", ",", "null", ")", ";", "return", "replyMessage", ";", "}" ]
Create the response message for this message. @return the response message (or null if none).
[ "Create", "the", "response", "message", "for", "this", "message", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageProcessInfo.java#L708-L718
154,251
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/execution/Executable.java
Executable.run
public void run() { try { Object result = execute(); if (!aborted) { this.retval = result; finished = true; } } catch (InterruptedException ie) { // } catch (Throwable t) { execException = t; finished = true; } }
java
public void run() { try { Object result = execute(); if (!aborted) { this.retval = result; finished = true; } } catch (InterruptedException ie) { // } catch (Throwable t) { execException = t; finished = true; } }
[ "public", "void", "run", "(", ")", "{", "try", "{", "Object", "result", "=", "execute", "(", ")", ";", "if", "(", "!", "aborted", ")", "{", "this", ".", "retval", "=", "result", ";", "finished", "=", "true", ";", "}", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "//", "}", "catch", "(", "Throwable", "t", ")", "{", "execException", "=", "t", ";", "finished", "=", "true", ";", "}", "}" ]
Used to invoke executable asynchronously.
[ "Used", "to", "invoke", "executable", "asynchronously", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/execution/Executable.java#L54-L69
154,252
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/execution/Executable.java
Executable.interrupt
public void interrupt() { if (!aborted) { aborted = true; if (executeThread != null) { executeThread.interrupt(); } if(helperExecutable != null) { helperExecutable.interrupt(); } } }
java
public void interrupt() { if (!aborted) { aborted = true; if (executeThread != null) { executeThread.interrupt(); } if(helperExecutable != null) { helperExecutable.interrupt(); } } }
[ "public", "void", "interrupt", "(", ")", "{", "if", "(", "!", "aborted", ")", "{", "aborted", "=", "true", ";", "if", "(", "executeThread", "!=", "null", ")", "{", "executeThread", ".", "interrupt", "(", ")", ";", "}", "if", "(", "helperExecutable", "!=", "null", ")", "{", "helperExecutable", ".", "interrupt", "(", ")", ";", "}", "}", "}" ]
Tries to interrupt execution. Execution code is interrupted if it sleeps once in a while.
[ "Tries", "to", "interrupt", "execution", ".", "Execution", "code", "is", "interrupted", "if", "it", "sleeps", "once", "in", "a", "while", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/execution/Executable.java#L174-L184
154,253
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java
SubCountHandler.init
public void init(Record record, Record recordMain, String iMainFilesField, BaseField fieldMain, String fsToCount, boolean bRecountOnSelect, boolean bVerifyOnEOF, boolean bResetOnBreak) // Init this field override for other value { super.init(record); this.fsToCount = fsToCount; if (fieldMain != null) m_fldMain = fieldMain; else if (recordMain != null) m_fldMain = recordMain.getField(iMainFilesField); if (m_fldMain != null) if ((m_fldMain.getRecord() == null) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_NONE) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_ADD)) this.resetCount(); // Set in main file's field if the record is not current. m_dOldValue = 0; m_bRecountOnSelect = bRecountOnSelect; m_bVerifyOnEOF = bVerifyOnEOF; m_bResetOnBreak = bResetOnBreak; m_dTotalToVerify = 0; m_bEOFHit = true; // In case this is a maint screen (grid screens start by requery/set this to false) }
java
public void init(Record record, Record recordMain, String iMainFilesField, BaseField fieldMain, String fsToCount, boolean bRecountOnSelect, boolean bVerifyOnEOF, boolean bResetOnBreak) // Init this field override for other value { super.init(record); this.fsToCount = fsToCount; if (fieldMain != null) m_fldMain = fieldMain; else if (recordMain != null) m_fldMain = recordMain.getField(iMainFilesField); if (m_fldMain != null) if ((m_fldMain.getRecord() == null) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_NONE) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_ADD)) this.resetCount(); // Set in main file's field if the record is not current. m_dOldValue = 0; m_bRecountOnSelect = bRecountOnSelect; m_bVerifyOnEOF = bVerifyOnEOF; m_bResetOnBreak = bResetOnBreak; m_dTotalToVerify = 0; m_bEOFHit = true; // In case this is a maint screen (grid screens start by requery/set this to false) }
[ "public", "void", "init", "(", "Record", "record", ",", "Record", "recordMain", ",", "String", "iMainFilesField", ",", "BaseField", "fieldMain", ",", "String", "fsToCount", ",", "boolean", "bRecountOnSelect", ",", "boolean", "bVerifyOnEOF", ",", "boolean", "bResetOnBreak", ")", "// Init this field override for other value", "{", "super", ".", "init", "(", "record", ")", ";", "this", ".", "fsToCount", "=", "fsToCount", ";", "if", "(", "fieldMain", "!=", "null", ")", "m_fldMain", "=", "fieldMain", ";", "else", "if", "(", "recordMain", "!=", "null", ")", "m_fldMain", "=", "recordMain", ".", "getField", "(", "iMainFilesField", ")", ";", "if", "(", "m_fldMain", "!=", "null", ")", "if", "(", "(", "m_fldMain", ".", "getRecord", "(", ")", "==", "null", ")", "||", "(", "m_fldMain", ".", "getRecord", "(", ")", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_NONE", ")", "||", "(", "m_fldMain", ".", "getRecord", "(", ")", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_ADD", ")", ")", "this", ".", "resetCount", "(", ")", ";", "// Set in main file's field if the record is not current.", "m_dOldValue", "=", "0", ";", "m_bRecountOnSelect", "=", "bRecountOnSelect", ";", "m_bVerifyOnEOF", "=", "bVerifyOnEOF", ";", "m_bResetOnBreak", "=", "bResetOnBreak", ";", "m_dTotalToVerify", "=", "0", ";", "m_bEOFHit", "=", "true", ";", "// In case this is a maint screen (grid screens start by requery/set this to false)", "}" ]
Constructor for counting the value of a field in this record. @param fieldMain The field to receive the count. @param ifsToCount The field in this record to add up. @param bVerifyOnEOF Verify the total on End of File (true default). @param bRecountOnSelect Recount the total each time a file select is called (False default). @param bResetOnBreak Reset the counter on a control break?
[ "Constructor", "for", "counting", "the", "value", "of", "a", "field", "in", "this", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java#L127-L144
154,254
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java
SubCountHandler.setCount
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
java
public int setCount(double dFieldCount, boolean bDisableListeners, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; if (m_fldMain != null) { boolean[] rgbEnabled = null; if (bDisableListeners) rgbEnabled = m_fldMain.setEnableListeners(false); int iOriginalValue = (int)m_fldMain.getValue(); boolean bOriginalModified = m_fldMain.isModified(); int iOldOpenMode = m_fldMain.getRecord().setOpenMode(m_fldMain.getRecord().getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // don't trigger refresh and write iErrorCode = m_fldMain.setValue(dFieldCount, true, iMoveMode); // Set in main file's field if the record is not current m_fldMain.getRecord().setOpenMode(iOldOpenMode); if (iOriginalValue == (int)m_fldMain.getValue()) if (bOriginalModified == false) m_fldMain.setModified(bOriginalModified); // Make sure this didn't change if change was just null to 0. if (rgbEnabled != null) m_fldMain.setEnableListeners(rgbEnabled); } return iErrorCode; }
[ "public", "int", "setCount", "(", "double", "dFieldCount", ",", "boolean", "bDisableListeners", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "m_fldMain", "!=", "null", ")", "{", "boolean", "[", "]", "rgbEnabled", "=", "null", ";", "if", "(", "bDisableListeners", ")", "rgbEnabled", "=", "m_fldMain", ".", "setEnableListeners", "(", "false", ")", ";", "int", "iOriginalValue", "=", "(", "int", ")", "m_fldMain", ".", "getValue", "(", ")", ";", "boolean", "bOriginalModified", "=", "m_fldMain", ".", "isModified", "(", ")", ";", "int", "iOldOpenMode", "=", "m_fldMain", ".", "getRecord", "(", ")", ".", "setOpenMode", "(", "m_fldMain", ".", "getRecord", "(", ")", ".", "getOpenMode", "(", ")", "&", "~", "DBConstants", ".", "OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY", ")", ";", "// don't trigger refresh and write", "iErrorCode", "=", "m_fldMain", ".", "setValue", "(", "dFieldCount", ",", "true", ",", "iMoveMode", ")", ";", "// Set in main file's field if the record is not current", "m_fldMain", ".", "getRecord", "(", ")", ".", "setOpenMode", "(", "iOldOpenMode", ")", ";", "if", "(", "iOriginalValue", "==", "(", "int", ")", "m_fldMain", ".", "getValue", "(", ")", ")", "if", "(", "bOriginalModified", "==", "false", ")", "m_fldMain", ".", "setModified", "(", "bOriginalModified", ")", ";", "// Make sure this didn't change if change was just null to 0.", "if", "(", "rgbEnabled", "!=", "null", ")", "m_fldMain", ".", "setEnableListeners", "(", "rgbEnabled", ")", ";", "}", "return", "iErrorCode", ";", "}" ]
Reset the field count. @param bDisableListeners Disable the field listeners (used for grid count verification) @param iMoveMode Move mode.
[ "Reset", "the", "field", "count", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java#L312-L332
154,255
GII/broccoli
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java
OWLSServiceBuilder.buildOWLSServiceFrom
public OWLSAtomicService buildOWLSServiceFrom(URI serviceURI, List<URI> modelURIs) throws ModelException { if (isFile(serviceURI)) { return buildOWLSServiceFromLocalOrRemoteURI(serviceURI, modelURIs); } else { Service service = OWLSStore.persistentModelAsOWLKB().getService(serviceURI); if (null == service) { throw new OWLTranslationException("Not found as a local file, nor a valid Service found in data store", null); } return buildOWLSServiceFrom(service); } }
java
public OWLSAtomicService buildOWLSServiceFrom(URI serviceURI, List<URI> modelURIs) throws ModelException { if (isFile(serviceURI)) { return buildOWLSServiceFromLocalOrRemoteURI(serviceURI, modelURIs); } else { Service service = OWLSStore.persistentModelAsOWLKB().getService(serviceURI); if (null == service) { throw new OWLTranslationException("Not found as a local file, nor a valid Service found in data store", null); } return buildOWLSServiceFrom(service); } }
[ "public", "OWLSAtomicService", "buildOWLSServiceFrom", "(", "URI", "serviceURI", ",", "List", "<", "URI", ">", "modelURIs", ")", "throws", "ModelException", "{", "if", "(", "isFile", "(", "serviceURI", ")", ")", "{", "return", "buildOWLSServiceFromLocalOrRemoteURI", "(", "serviceURI", ",", "modelURIs", ")", ";", "}", "else", "{", "Service", "service", "=", "OWLSStore", ".", "persistentModelAsOWLKB", "(", ")", ".", "getService", "(", "serviceURI", ")", ";", "if", "(", "null", "==", "service", ")", "{", "throw", "new", "OWLTranslationException", "(", "\"Not found as a local file, nor a valid Service found in data store\"", ",", "null", ")", ";", "}", "return", "buildOWLSServiceFrom", "(", "service", ")", ";", "}", "}" ]
Builds an OWLSAtomicService @param serviceURI the URI that identifies the service @param modelURIs a List of URIs for ontologies that may be used by the service to be loaded @return @throws ModelException
[ "Builds", "an", "OWLSAtomicService" ]
a3033a90322cbcee4dc0f1719143b84b822bc4ba
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java#L76-L90
154,256
GII/broccoli
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java
OWLSServiceBuilder.buildOWLSServiceFrom
public OWLSAtomicService buildOWLSServiceFrom(Service owlsService) throws ModelException { OWLSAtomicService service = new OWLSAtomicService(owlsService); return completeOWLSServiceIfNeeded(service); }
java
public OWLSAtomicService buildOWLSServiceFrom(Service owlsService) throws ModelException { OWLSAtomicService service = new OWLSAtomicService(owlsService); return completeOWLSServiceIfNeeded(service); }
[ "public", "OWLSAtomicService", "buildOWLSServiceFrom", "(", "Service", "owlsService", ")", "throws", "ModelException", "{", "OWLSAtomicService", "service", "=", "new", "OWLSAtomicService", "(", "owlsService", ")", ";", "return", "completeOWLSServiceIfNeeded", "(", "service", ")", ";", "}" ]
Builds an OWLSAtomicService, from a given Service object @param owlsService @return @throws ModelException
[ "Builds", "an", "OWLSAtomicService", "from", "a", "given", "Service", "object" ]
a3033a90322cbcee4dc0f1719143b84b822bc4ba
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java#L99-L103
154,257
GII/broccoli
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java
OWLSServiceBuilder.buildOWLSServiceFromLocalOrRemoteURI
private OWLSAtomicService buildOWLSServiceFromLocalOrRemoteURI(URI serviceURI, List<URI> modelURIs) throws ModelException { BSDFLogger.getLogger().info("Builds OWL service (BSDF functionality) from: " + serviceURI.toString()); OWLContainer owlSyntaxTranslator = new OWLContainer(); OWLKnowledgeBase kb = KBWithReasonerBuilder.newKB(); if (null != modelURIs) { for (URI uri : modelURIs) { owlSyntaxTranslator.loadOntologyIfNotLoaded(uri); } } owlSyntaxTranslator.loadAsServiceIntoKB(kb, serviceURI); OWLSAtomicService service = new OWLSAtomicService(kb.getServices(false).iterator().next()); return completeOWLSServiceIfNeeded(service); }
java
private OWLSAtomicService buildOWLSServiceFromLocalOrRemoteURI(URI serviceURI, List<URI> modelURIs) throws ModelException { BSDFLogger.getLogger().info("Builds OWL service (BSDF functionality) from: " + serviceURI.toString()); OWLContainer owlSyntaxTranslator = new OWLContainer(); OWLKnowledgeBase kb = KBWithReasonerBuilder.newKB(); if (null != modelURIs) { for (URI uri : modelURIs) { owlSyntaxTranslator.loadOntologyIfNotLoaded(uri); } } owlSyntaxTranslator.loadAsServiceIntoKB(kb, serviceURI); OWLSAtomicService service = new OWLSAtomicService(kb.getServices(false).iterator().next()); return completeOWLSServiceIfNeeded(service); }
[ "private", "OWLSAtomicService", "buildOWLSServiceFromLocalOrRemoteURI", "(", "URI", "serviceURI", ",", "List", "<", "URI", ">", "modelURIs", ")", "throws", "ModelException", "{", "BSDFLogger", ".", "getLogger", "(", ")", ".", "info", "(", "\"Builds OWL service (BSDF functionality) from: \"", "+", "serviceURI", ".", "toString", "(", ")", ")", ";", "OWLContainer", "owlSyntaxTranslator", "=", "new", "OWLContainer", "(", ")", ";", "OWLKnowledgeBase", "kb", "=", "KBWithReasonerBuilder", ".", "newKB", "(", ")", ";", "if", "(", "null", "!=", "modelURIs", ")", "{", "for", "(", "URI", "uri", ":", "modelURIs", ")", "{", "owlSyntaxTranslator", ".", "loadOntologyIfNotLoaded", "(", "uri", ")", ";", "}", "}", "owlSyntaxTranslator", ".", "loadAsServiceIntoKB", "(", "kb", ",", "serviceURI", ")", ";", "OWLSAtomicService", "service", "=", "new", "OWLSAtomicService", "(", "kb", ".", "getServices", "(", "false", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "return", "completeOWLSServiceIfNeeded", "(", "service", ")", ";", "}" ]
Builds an OWLSAtomicService, from a given URI that has to be a local file or an http URL @param serviceURI the URI for the service location @param modelURIs a List of URIs for ontologies that may be used by the service to be loaded (currently needed when the service is written in functional or turtle syntax) @return @throws ModelException
[ "Builds", "an", "OWLSAtomicService", "from", "a", "given", "URI", "that", "has", "to", "be", "a", "local", "file", "or", "an", "http", "URL" ]
a3033a90322cbcee4dc0f1719143b84b822bc4ba
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/serviceBuilder/OWLSServiceBuilder.java#L129-L145
154,258
mbenson/uelbox
src/main/java/uelbox/ELContextWrapper.java
ELContextWrapper.getTypedContext
public final <T> T getTypedContext(Class<T> key, T defaultValue) { return UEL.getContext(this, key, defaultValue); }
java
public final <T> T getTypedContext(Class<T> key, T defaultValue) { return UEL.getContext(this, key, defaultValue); }
[ "public", "final", "<", "T", ">", "T", "getTypedContext", "(", "Class", "<", "T", ">", "key", ",", "T", "defaultValue", ")", "{", "return", "UEL", ".", "getContext", "(", "this", ",", "key", ",", "defaultValue", ")", ";", "}" ]
Convenience method to return a typed context object when key resolves per documented convention to an object of the same type. @param <T> @param key @param defaultValue if absent @return T @see ELContext#getContext(Class)
[ "Convenience", "method", "to", "return", "a", "typed", "context", "object", "when", "key", "resolves", "per", "documented", "convention", "to", "an", "object", "of", "the", "same", "type", "." ]
b0c2df2c738295bddfd3c16a916e67c9c7c512ef
https://github.com/mbenson/uelbox/blob/b0c2df2c738295bddfd3c16a916e67c9c7c512ef/src/main/java/uelbox/ELContextWrapper.java#L151-L153
154,259
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java
SubscriptionManager.subscribe
public <T extends EventListener> void subscribe(EventPublisher source, T listener) { if (source == null || listener == null) { throw new IllegalArgumentException("Parameters cannot be null"); } log.debug("[subscribe] Adding {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); if (dispatcher == null) { log.warn("[subscribe] Registering with a disconnected source"); dispatcher = createDispatcher(source); } dispatcher.addListener(listener); }
java
public <T extends EventListener> void subscribe(EventPublisher source, T listener) { if (source == null || listener == null) { throw new IllegalArgumentException("Parameters cannot be null"); } log.debug("[subscribe] Adding {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); if (dispatcher == null) { log.warn("[subscribe] Registering with a disconnected source"); dispatcher = createDispatcher(source); } dispatcher.addListener(listener); }
[ "public", "<", "T", "extends", "EventListener", ">", "void", "subscribe", "(", "EventPublisher", "source", ",", "T", "listener", ")", "{", "if", "(", "source", "==", "null", "||", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameters cannot be null\"", ")", ";", "}", "log", ".", "debug", "(", "\"[subscribe] Adding {} --> {}\"", ",", "source", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "listener", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "GenericEventDispatcher", "<", "T", ">", "dispatcher", "=", "(", "GenericEventDispatcher", "<", "T", ">", ")", "dispatchers", ".", "get", "(", "source", ")", ";", "if", "(", "dispatcher", "==", "null", ")", "{", "log", ".", "warn", "(", "\"[subscribe] Registering with a disconnected source\"", ")", ";", "dispatcher", "=", "createDispatcher", "(", "source", ")", ";", "}", "dispatcher", ".", "addListener", "(", "listener", ")", ";", "}" ]
Binds a listener to a publisher @param source the event publisher @param listener the event receiver
[ "Binds", "a", "listener", "to", "a", "publisher" ]
c3dabf5a145e57b2a6de89c1910851b8a8ae6064
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L30-L44
154,260
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java
SubscriptionManager.unsubscribe
public <T extends EventListener> void unsubscribe(EventPublisher source, T listener) { log.debug("[unsubscribe] Removing {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); dispatcher.removeListener(listener); }
java
public <T extends EventListener> void unsubscribe(EventPublisher source, T listener) { log.debug("[unsubscribe] Removing {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); dispatcher.removeListener(listener); }
[ "public", "<", "T", "extends", "EventListener", ">", "void", "unsubscribe", "(", "EventPublisher", "source", ",", "T", "listener", ")", "{", "log", ".", "debug", "(", "\"[unsubscribe] Removing {} --> {}\"", ",", "source", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "listener", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "GenericEventDispatcher", "<", "T", ">", "dispatcher", "=", "(", "GenericEventDispatcher", "<", "T", ">", ")", "dispatchers", ".", "get", "(", "source", ")", ";", "dispatcher", ".", "removeListener", "(", "listener", ")", ";", "}" ]
Unbinds a listener to a publisher @param source the event publisher @param listener the event receiver
[ "Unbinds", "a", "listener", "to", "a", "publisher" ]
c3dabf5a145e57b2a6de89c1910851b8a8ae6064
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L59-L63
154,261
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java
SubscriptionManager.getEventDispatcher
public EventDispatcher getEventDispatcher(EventPublisher source) { EventDispatcher ret = dispatchers.get(source); if (ret == null) { ret = createDispatcher(source); } return ret; }
java
public EventDispatcher getEventDispatcher(EventPublisher source) { EventDispatcher ret = dispatchers.get(source); if (ret == null) { ret = createDispatcher(source); } return ret; }
[ "public", "EventDispatcher", "getEventDispatcher", "(", "EventPublisher", "source", ")", "{", "EventDispatcher", "ret", "=", "dispatchers", ".", "get", "(", "source", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "ret", "=", "createDispatcher", "(", "source", ")", ";", "}", "return", "ret", ";", "}" ]
Gets the object used to fire events @param source the event publisher @return the object used to fire events
[ "Gets", "the", "object", "used", "to", "fire", "events" ]
c3dabf5a145e57b2a6de89c1910851b8a8ae6064
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L71-L77
154,262
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java
SubscriptionManager.getSubscribersCount
public int getSubscribersCount(EventPublisher source) { GenericEventDispatcher<?> dispatcherObject = dispatchers.get(source); if (dispatcherObject == null) { return 0; } else { return dispatcherObject.getListenersCount(); } }
java
public int getSubscribersCount(EventPublisher source) { GenericEventDispatcher<?> dispatcherObject = dispatchers.get(source); if (dispatcherObject == null) { return 0; } else { return dispatcherObject.getListenersCount(); } }
[ "public", "int", "getSubscribersCount", "(", "EventPublisher", "source", ")", "{", "GenericEventDispatcher", "<", "?", ">", "dispatcherObject", "=", "dispatchers", ".", "get", "(", "source", ")", ";", "if", "(", "dispatcherObject", "==", "null", ")", "{", "return", "0", ";", "}", "else", "{", "return", "dispatcherObject", ".", "getListenersCount", "(", ")", ";", "}", "}" ]
Gets the number of listeners registered for a publisher @param source the event publisher @return the number of listeners registered for a publisher
[ "Gets", "the", "number", "of", "listeners", "registered", "for", "a", "publisher" ]
c3dabf5a145e57b2a6de89c1910851b8a8ae6064
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L113-L121
154,263
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.createShowAndPosition
public static JFrame createShowAndPosition(final String title, final Container content, final boolean exitOnClose, final FramePositioner positioner) { return createShowAndPosition(title, content, exitOnClose, true, positioner); }
java
public static JFrame createShowAndPosition(final String title, final Container content, final boolean exitOnClose, final FramePositioner positioner) { return createShowAndPosition(title, content, exitOnClose, true, positioner); }
[ "public", "static", "JFrame", "createShowAndPosition", "(", "final", "String", "title", ",", "final", "Container", "content", ",", "final", "boolean", "exitOnClose", ",", "final", "FramePositioner", "positioner", ")", "{", "return", "createShowAndPosition", "(", "title", ",", "content", ",", "exitOnClose", ",", "true", ",", "positioner", ")", ";", "}" ]
Create a new resizeable frame with a panel as it's content pane and position the frame. @param title Frame title. @param content Content. @param exitOnClose Exit the program on closing the frame? @param positioner FramePositioner. @return A visible frame at the preferred position.
[ "Create", "a", "new", "resizeable", "frame", "with", "a", "panel", "as", "it", "s", "content", "pane", "and", "position", "the", "frame", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L66-L69
154,264
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.loadIcon
public static ImageIcon loadIcon(final Class clasz, final String name) { final URL url = Utils4J.getResource(clasz, name); return new ImageIcon(url); }
java
public static ImageIcon loadIcon(final Class clasz, final String name) { final URL url = Utils4J.getResource(clasz, name); return new ImageIcon(url); }
[ "public", "static", "ImageIcon", "loadIcon", "(", "final", "Class", "clasz", ",", "final", "String", "name", ")", "{", "final", "URL", "url", "=", "Utils4J", ".", "getResource", "(", "clasz", ",", "name", ")", ";", "return", "new", "ImageIcon", "(", "url", ")", ";", "}" ]
Load an icon located in the same package as a given class. @param clasz Class with the same package where the icon is located. @param name Filename of the icon. @return New icon instance.
[ "Load", "an", "icon", "located", "in", "the", "same", "package", "as", "a", "given", "class", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L124-L127
154,265
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.initLookAndFeelIntern
private static void initLookAndFeelIntern(final String className) { try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); } }
java
private static void initLookAndFeelIntern(final String className) { try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); } }
[ "private", "static", "void", "initLookAndFeelIntern", "(", "final", "String", "className", ")", "{", "try", "{", "UIManager", ".", "setLookAndFeel", "(", "className", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error initializing the Look And Feel!\"", ",", "e", ")", ";", "}", "}" ]
Initializes the look and feel and wraps exceptions into a runtime exception. It's executed in the calling thread. @param className Full qualified name of the look and feel class.
[ "Initializes", "the", "look", "and", "feel", "and", "wraps", "exceptions", "into", "a", "runtime", "exception", ".", "It", "s", "executed", "in", "the", "calling", "thread", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L136-L142
154,266
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.findRootPaneContainer
public static RootPaneContainer findRootPaneContainer(final Component source) { Component comp = source; while ((comp != null) && !(comp instanceof RootPaneContainer)) { comp = comp.getParent(); } if (comp instanceof RootPaneContainer) { return (RootPaneContainer) comp; } return null; }
java
public static RootPaneContainer findRootPaneContainer(final Component source) { Component comp = source; while ((comp != null) && !(comp instanceof RootPaneContainer)) { comp = comp.getParent(); } if (comp instanceof RootPaneContainer) { return (RootPaneContainer) comp; } return null; }
[ "public", "static", "RootPaneContainer", "findRootPaneContainer", "(", "final", "Component", "source", ")", "{", "Component", "comp", "=", "source", ";", "while", "(", "(", "comp", "!=", "null", ")", "&&", "!", "(", "comp", "instanceof", "RootPaneContainer", ")", ")", "{", "comp", "=", "comp", ".", "getParent", "(", ")", ";", "}", "if", "(", "comp", "instanceof", "RootPaneContainer", ")", "{", "return", "(", "RootPaneContainer", ")", "comp", ";", "}", "return", "null", ";", "}" ]
Find the root pane container in the current hierarchy. @param source Component to start with. @return Root pane container or NULL if it cannot be found.
[ "Find", "the", "root", "pane", "container", "in", "the", "current", "hierarchy", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L187-L196
154,267
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.showGlassPane
public static GlassPaneState showGlassPane(final Component source) { final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getFocusOwner(); final RootPaneContainer rootPaneContainer = findRootPaneContainer(source); final Component glassPane = rootPaneContainer.getGlassPane(); final MouseListener mouseListener = new MouseAdapter() { }; final Cursor cursor = glassPane.getCursor(); glassPane.addMouseListener(mouseListener); glassPane.setVisible(true); glassPane.requestFocus(); glassPane.setCursor(new Cursor(Cursor.WAIT_CURSOR)); return new GlassPaneState(glassPane, mouseListener, focusOwner, cursor); }
java
public static GlassPaneState showGlassPane(final Component source) { final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager() .getFocusOwner(); final RootPaneContainer rootPaneContainer = findRootPaneContainer(source); final Component glassPane = rootPaneContainer.getGlassPane(); final MouseListener mouseListener = new MouseAdapter() { }; final Cursor cursor = glassPane.getCursor(); glassPane.addMouseListener(mouseListener); glassPane.setVisible(true); glassPane.requestFocus(); glassPane.setCursor(new Cursor(Cursor.WAIT_CURSOR)); return new GlassPaneState(glassPane, mouseListener, focusOwner, cursor); }
[ "public", "static", "GlassPaneState", "showGlassPane", "(", "final", "Component", "source", ")", "{", "final", "Component", "focusOwner", "=", "KeyboardFocusManager", ".", "getCurrentKeyboardFocusManager", "(", ")", ".", "getFocusOwner", "(", ")", ";", "final", "RootPaneContainer", "rootPaneContainer", "=", "findRootPaneContainer", "(", "source", ")", ";", "final", "Component", "glassPane", "=", "rootPaneContainer", ".", "getGlassPane", "(", ")", ";", "final", "MouseListener", "mouseListener", "=", "new", "MouseAdapter", "(", ")", "{", "}", ";", "final", "Cursor", "cursor", "=", "glassPane", ".", "getCursor", "(", ")", ";", "glassPane", ".", "addMouseListener", "(", "mouseListener", ")", ";", "glassPane", ".", "setVisible", "(", "true", ")", ";", "glassPane", ".", "requestFocus", "(", ")", ";", "glassPane", ".", "setCursor", "(", "new", "Cursor", "(", "Cursor", ".", "WAIT_CURSOR", ")", ")", ";", "return", "new", "GlassPaneState", "(", "glassPane", ",", "mouseListener", ",", "focusOwner", ",", "cursor", ")", ";", "}" ]
Makes the glass pane visible and focused and stores the saves the current state. @param source Component to use when looking for the root pane container. @return State of the UI before the glasspane was visible.
[ "Makes", "the", "glass", "pane", "visible", "and", "focused", "and", "stores", "the", "saves", "the", "current", "state", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L207-L220
154,268
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/common/Utils4Swing.java
Utils4Swing.hideGlassPane
public static void hideGlassPane(final GlassPaneState state) { Utils4J.checkNotNull("state", state); final Component glassPane = state.getGlassPane(); glassPane.removeMouseListener(state.getMouseListener()); glassPane.setCursor(state.getCursor()); glassPane.setVisible(false); if (state.getFocusOwner() != null) { state.getFocusOwner().requestFocus(); } }
java
public static void hideGlassPane(final GlassPaneState state) { Utils4J.checkNotNull("state", state); final Component glassPane = state.getGlassPane(); glassPane.removeMouseListener(state.getMouseListener()); glassPane.setCursor(state.getCursor()); glassPane.setVisible(false); if (state.getFocusOwner() != null) { state.getFocusOwner().requestFocus(); } }
[ "public", "static", "void", "hideGlassPane", "(", "final", "GlassPaneState", "state", ")", "{", "Utils4J", ".", "checkNotNull", "(", "\"state\"", ",", "state", ")", ";", "final", "Component", "glassPane", "=", "state", ".", "getGlassPane", "(", ")", ";", "glassPane", ".", "removeMouseListener", "(", "state", ".", "getMouseListener", "(", ")", ")", ";", "glassPane", ".", "setCursor", "(", "state", ".", "getCursor", "(", ")", ")", ";", "glassPane", ".", "setVisible", "(", "false", ")", ";", "if", "(", "state", ".", "getFocusOwner", "(", ")", "!=", "null", ")", "{", "state", ".", "getFocusOwner", "(", ")", ".", "requestFocus", "(", ")", ";", "}", "}" ]
Hides the glass pane and restores the saved state. @param state State to restore - Cannot be <code>null</code>.
[ "Hides", "the", "glass", "pane", "and", "restores", "the", "saved", "state", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/common/Utils4Swing.java#L228-L237
154,269
entrusc/xdata
src/main/java/com/moebiusgames/xdata/DataNode.java
DataNode.setObject
public <T> void setObject(DataKey<T> key, T object) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (object == null && !key.allowNull()) { throw new IllegalArgumentException("key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), object); }
java
public <T> void setObject(DataKey<T> key, T object) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (object == null && !key.allowNull()) { throw new IllegalArgumentException("key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), object); }
[ "public", "<", "T", ">", "void", "setObject", "(", "DataKey", "<", "T", ">", "key", ",", "T", "object", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key must not be null\"", ")", ";", "}", "if", "(", "object", "==", "null", "&&", "!", "key", ".", "allowNull", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key \\\"\"", "+", "key", ".", "getName", "(", ")", "+", "\"\\\" disallows null values but object was null\"", ")", ";", "}", "data", ".", "put", "(", "key", ".", "getName", "(", ")", ",", "object", ")", ";", "}" ]
stores an object for the given key @param <T> @param key @param object
[ "stores", "an", "object", "for", "the", "given", "key" ]
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataNode.java#L113-L121
154,270
entrusc/xdata
src/main/java/com/moebiusgames/xdata/DataNode.java
DataNode.setObjectList
public <T> void setObjectList(ListDataKey<T> key, List<T> objects) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (objects == null && !key.allowNull()) { throw new IllegalArgumentException("list key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), deepListCopy(objects)); }
java
public <T> void setObjectList(ListDataKey<T> key, List<T> objects) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (objects == null && !key.allowNull()) { throw new IllegalArgumentException("list key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), deepListCopy(objects)); }
[ "public", "<", "T", ">", "void", "setObjectList", "(", "ListDataKey", "<", "T", ">", "key", ",", "List", "<", "T", ">", "objects", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key must not be null\"", ")", ";", "}", "if", "(", "objects", "==", "null", "&&", "!", "key", ".", "allowNull", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"list key \\\"\"", "+", "key", ".", "getName", "(", ")", "+", "\"\\\" disallows null values but object was null\"", ")", ";", "}", "data", ".", "put", "(", "key", ".", "getName", "(", ")", ",", "deepListCopy", "(", "objects", ")", ")", ";", "}" ]
stores a list of objects for a given key @param <T> @param key a list data key (where isList is set to true) @param objects
[ "stores", "a", "list", "of", "objects", "for", "a", "given", "key" ]
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataNode.java#L130-L138
154,271
lshift/jamume
src/main/java/net/lshift/java/dispatch/Delegate.java
Delegate.delegateIf
@SuppressWarnings("unchecked") public static <C> C delegateIf( Class<C> contract, Supplier<C> target, Supplier<Boolean> condition) { checkVoid(contract); return (C)Proxy.newProxyInstance( contract.getClassLoader(), new Class [] { contract }, invocationHandler(contract, target, condition)); }
java
@SuppressWarnings("unchecked") public static <C> C delegateIf( Class<C> contract, Supplier<C> target, Supplier<Boolean> condition) { checkVoid(contract); return (C)Proxy.newProxyInstance( contract.getClassLoader(), new Class [] { contract }, invocationHandler(contract, target, condition)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "C", ">", "C", "delegateIf", "(", "Class", "<", "C", ">", "contract", ",", "Supplier", "<", "C", ">", "target", ",", "Supplier", "<", "Boolean", ">", "condition", ")", "{", "checkVoid", "(", "contract", ")", ";", "return", "(", "C", ")", "Proxy", ".", "newProxyInstance", "(", "contract", ".", "getClassLoader", "(", ")", ",", "new", "Class", "[", "]", "{", "contract", "}", ",", "invocationHandler", "(", "contract", ",", "target", ",", "condition", ")", ")", ";", "}" ]
Create a proxy which only delegates if a condition is true. @param <C> the contract class @param contract the contract class @param target the object to delegate to @param condition - if Reference.get() returns true at the time of the call, then the method will be executed, otherwise not. @return
[ "Create", "a", "proxy", "which", "only", "delegates", "if", "a", "condition", "is", "true", "." ]
754d9ab29311601328a2f39928775e4e010305b7
https://github.com/lshift/jamume/blob/754d9ab29311601328a2f39928775e4e010305b7/src/main/java/net/lshift/java/dispatch/Delegate.java#L34-L45
154,272
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JFSTextScroller.java
JFSTextScroller.keyPressed
public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { boolean bDoTab = true; int iTextLength = m_control.getDocument().getLength(); if (((m_control.getSelectionStart() == 0) || (m_control.getSelectionStart() == iTextLength)) && ((m_control.getSelectionEnd() == 0) || (m_control.getSelectionEnd() == iTextLength))) bDoTab = true; else bDoTab = false; // Not fully selected, definitely process this key if (bDoTab) { if (m_bDirty) bDoTab = false; // Data changed, definetly process this key } if (evt.getKeyCode() == KeyEvent.VK_ENTER) if (!bDoTab) return; // Do not consume... process the return in the control evt.consume(); // Don't process the tab as an input character... tab to the next/prev field. this.transferFocus(); // Move focus to next component return; } m_bDirty = true; }
java
public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == KeyEvent.VK_ENTER) { boolean bDoTab = true; int iTextLength = m_control.getDocument().getLength(); if (((m_control.getSelectionStart() == 0) || (m_control.getSelectionStart() == iTextLength)) && ((m_control.getSelectionEnd() == 0) || (m_control.getSelectionEnd() == iTextLength))) bDoTab = true; else bDoTab = false; // Not fully selected, definitely process this key if (bDoTab) { if (m_bDirty) bDoTab = false; // Data changed, definetly process this key } if (evt.getKeyCode() == KeyEvent.VK_ENTER) if (!bDoTab) return; // Do not consume... process the return in the control evt.consume(); // Don't process the tab as an input character... tab to the next/prev field. this.transferFocus(); // Move focus to next component return; } m_bDirty = true; }
[ "public", "void", "keyPressed", "(", "KeyEvent", "evt", ")", "{", "if", "(", "evt", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_ENTER", ")", "{", "boolean", "bDoTab", "=", "true", ";", "int", "iTextLength", "=", "m_control", ".", "getDocument", "(", ")", ".", "getLength", "(", ")", ";", "if", "(", "(", "(", "m_control", ".", "getSelectionStart", "(", ")", "==", "0", ")", "||", "(", "m_control", ".", "getSelectionStart", "(", ")", "==", "iTextLength", ")", ")", "&&", "(", "(", "m_control", ".", "getSelectionEnd", "(", ")", "==", "0", ")", "||", "(", "m_control", ".", "getSelectionEnd", "(", ")", "==", "iTextLength", ")", ")", ")", "bDoTab", "=", "true", ";", "else", "bDoTab", "=", "false", ";", "// Not fully selected, definitely process this key", "if", "(", "bDoTab", ")", "{", "if", "(", "m_bDirty", ")", "bDoTab", "=", "false", ";", "// Data changed, definetly process this key", "}", "if", "(", "evt", ".", "getKeyCode", "(", ")", "==", "KeyEvent", ".", "VK_ENTER", ")", "if", "(", "!", "bDoTab", ")", "return", ";", "// Do not consume... process the return in the control", "evt", ".", "consume", "(", ")", ";", "// Don't process the tab as an input character... tab to the next/prev field.", "this", ".", "transferFocus", "(", ")", ";", "// Move focus to next component", "return", ";", "}", "m_bDirty", "=", "true", ";", "}" ]
key released, if tab, select next field.
[ "key", "released", "if", "tab", "select", "next", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JFSTextScroller.java#L120-L145
154,273
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.unmarshalRootElement
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { // Override this! (If you can!) TransformerFactory tFact = TransformerFactory.newInstance(); Source source = new DOMSource(node); Writer writer = new StringWriter(); Result result = new StreamResult(writer); Transformer transformer = tFact.newTransformer(); transformer.transform(source, result); writer.flush(); writer.close(); String strXMLBody = writer.toString(); Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream, soapTrxMessage); inStream.close(); return msg; }
java
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { // Override this! (If you can!) TransformerFactory tFact = TransformerFactory.newInstance(); Source source = new DOMSource(node); Writer writer = new StringWriter(); Result result = new StreamResult(writer); Transformer transformer = tFact.newTransformer(); transformer.transform(source, result); writer.flush(); writer.close(); String strXMLBody = writer.toString(); Reader inStream = new StringReader(strXMLBody); Object msg = this.unmarshalRootElement(inStream, soapTrxMessage); inStream.close(); return msg; }
[ "public", "Object", "unmarshalRootElement", "(", "Node", "node", ",", "BaseXmlTrxMessageIn", "soapTrxMessage", ")", "throws", "Exception", "{", "// Override this! (If you can!)", "TransformerFactory", "tFact", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "Source", "source", "=", "new", "DOMSource", "(", "node", ")", ";", "Writer", "writer", "=", "new", "StringWriter", "(", ")", ";", "Result", "result", "=", "new", "StreamResult", "(", "writer", ")", ";", "Transformer", "transformer", "=", "tFact", ".", "newTransformer", "(", ")", ";", "transformer", ".", "transform", "(", "source", ",", "result", ")", ";", "writer", ".", "flush", "(", ")", ";", "writer", ".", "close", "(", ")", ";", "String", "strXMLBody", "=", "writer", ".", "toString", "(", ")", ";", "Reader", "inStream", "=", "new", "StringReader", "(", "strXMLBody", ")", ";", "Object", "msg", "=", "this", ".", "unmarshalRootElement", "(", "inStream", ",", "soapTrxMessage", ")", ";", "inStream", ".", "close", "(", ")", ";", "return", "msg", ";", "}" ]
Create the root element for this message. You SHOULD override this if the unmarshaller has a native method to unmarshall a dom node. @return The root element.
[ "Create", "the", "root", "element", "for", "this", "message", ".", "You", "SHOULD", "override", "this", "if", "the", "unmarshaller", "has", "a", "native", "method", "to", "unmarshall", "a", "dom", "node", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L105-L128
154,274
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.addPayloadProperties
public void addPayloadProperties(Object msg, BaseMessage message) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames); for (String key : properties.keySet()) { message.put(key, properties.get(key)); } } } }
java
public void addPayloadProperties(Object msg, BaseMessage message) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames); for (String key : properties.keySet()) { message.put(key, properties.get(key)); } } } }
[ "public", "void", "addPayloadProperties", "(", "Object", "msg", ",", "BaseMessage", "message", ")", "{", "MessageDataDesc", "messageDataDesc", "=", "message", ".", "getMessageDataDesc", "(", "null", ")", ";", "// Top level only", "if", "(", "messageDataDesc", "!=", "null", ")", "{", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "mapPropertyNames", "=", "messageDataDesc", ".", "getPayloadPropertyNames", "(", "null", ")", ";", "if", "(", "mapPropertyNames", "!=", "null", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "this", ".", "getPayloadProperties", "(", "msg", ",", "mapPropertyNames", ")", ";", "for", "(", "String", "key", ":", "properties", ".", "keySet", "(", ")", ")", "{", "message", ".", "put", "(", "key", ",", "properties", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}", "}" ]
Utility to add the standard payload properties to the message @param msg @param message
[ "Utility", "to", "add", "the", "standard", "payload", "properties", "to", "the", "message" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L161-L177
154,275
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.getPayloadProperties
public Map<String,Object> getPayloadProperties(Object msg, Map<String,Class<?>> mapPropertyNames) { Map<String,Object> properties = new HashMap<String,Object>(); for (String strKey : mapPropertyNames.keySet()) { this.addPayloadProperty(msg, properties, strKey); } this.addPayloadProperty(msg, properties, "Errors"); // For responses only return properties; }
java
public Map<String,Object> getPayloadProperties(Object msg, Map<String,Class<?>> mapPropertyNames) { Map<String,Object> properties = new HashMap<String,Object>(); for (String strKey : mapPropertyNames.keySet()) { this.addPayloadProperty(msg, properties, strKey); } this.addPayloadProperty(msg, properties, "Errors"); // For responses only return properties; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getPayloadProperties", "(", "Object", "msg", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "mapPropertyNames", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "for", "(", "String", "strKey", ":", "mapPropertyNames", ".", "keySet", "(", ")", ")", "{", "this", ".", "addPayloadProperty", "(", "msg", ",", "properties", ",", "strKey", ")", ";", "}", "this", ".", "addPayloadProperty", "(", "msg", ",", "properties", ",", "\"Errors\"", ")", ";", "// For responses only ", "return", "properties", ";", "}" ]
Get all the payload properties. @param msg @return
[ "Get", "all", "the", "payload", "properties", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L183-L193
154,276
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.addPayloadProperty
public void addPayloadProperty(Object msg, Map<String,Object> properties, String key) { String name = "get" + key; try { Method method = msg.getClass().getMethod(name, EMPTY_PARAMS); if (method != null) { Object value = method.invoke(msg, EMPTY_DATA); if (value != null) { if (value.getClass().getName().contains("ErrorsType")) this.addErrorsProperties(properties, value); else properties.put(key, value); } } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { // Ignore this error } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
java
public void addPayloadProperty(Object msg, Map<String,Object> properties, String key) { String name = "get" + key; try { Method method = msg.getClass().getMethod(name, EMPTY_PARAMS); if (method != null) { Object value = method.invoke(msg, EMPTY_DATA); if (value != null) { if (value.getClass().getName().contains("ErrorsType")) this.addErrorsProperties(properties, value); else properties.put(key, value); } } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { // Ignore this error } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
[ "public", "void", "addPayloadProperty", "(", "Object", "msg", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "String", "key", ")", "{", "String", "name", "=", "\"get\"", "+", "key", ";", "try", "{", "Method", "method", "=", "msg", ".", "getClass", "(", ")", ".", "getMethod", "(", "name", ",", "EMPTY_PARAMS", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "Object", "value", "=", "method", ".", "invoke", "(", "msg", ",", "EMPTY_DATA", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "if", "(", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "contains", "(", "\"ErrorsType\"", ")", ")", "this", ".", "addErrorsProperties", "(", "properties", ",", "value", ")", ";", "else", "properties", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}", "}", "catch", "(", "SecurityException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "// Ignore this error", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Add this payload property to this map. @param msg @param properties @param key
[ "Add", "this", "payload", "property", "to", "this", "map", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L200-L225
154,277
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java
BaseConvertToMessage.addErrorsProperties
public void addErrorsProperties(Map<String,Object> properties, Object errorsType) { try { Method method = errorsType.getClass().getMethod("getErrors", EMPTY_PARAMS); if (method != null) { Object value = method.invoke(errorsType, EMPTY_DATA); if (value instanceof List<?>) { for (Object errorType : (List<?>)value) { method = errorType.getClass().getMethod("getShortText", EMPTY_PARAMS); if (method != null) { value = method.invoke(errorType, EMPTY_DATA); if (value instanceof String) properties.put("Error", value); } } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
java
public void addErrorsProperties(Map<String,Object> properties, Object errorsType) { try { Method method = errorsType.getClass().getMethod("getErrors", EMPTY_PARAMS); if (method != null) { Object value = method.invoke(errorsType, EMPTY_DATA); if (value instanceof List<?>) { for (Object errorType : (List<?>)value) { method = errorType.getClass().getMethod("getShortText", EMPTY_PARAMS); if (method != null) { value = method.invoke(errorType, EMPTY_DATA); if (value instanceof String) properties.put("Error", value); } } } } } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } }
[ "public", "void", "addErrorsProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ",", "Object", "errorsType", ")", "{", "try", "{", "Method", "method", "=", "errorsType", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"getErrors\"", ",", "EMPTY_PARAMS", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "Object", "value", "=", "method", ".", "invoke", "(", "errorsType", ",", "EMPTY_DATA", ")", ";", "if", "(", "value", "instanceof", "List", "<", "?", ">", ")", "{", "for", "(", "Object", "errorType", ":", "(", "List", "<", "?", ">", ")", "value", ")", "{", "method", "=", "errorType", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"getShortText\"", ",", "EMPTY_PARAMS", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "value", "=", "method", ".", "invoke", "(", "errorType", ",", "EMPTY_DATA", ")", ";", "if", "(", "value", "instanceof", "String", ")", "properties", ".", "put", "(", "\"Error\"", ",", "value", ")", ";", "}", "}", "}", "}", "}", "catch", "(", "SecurityException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Add the error properties from this message. @param properties @param errorsType
[ "Add", "the", "error", "properties", "from", "this", "message", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L231-L263
154,278
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/Location.java
Location.radius
@Unit(NM) public static double radius(Location... location) { Location center = center(location); double max = 0; for (Location loc : location) { Distance distance = distance(loc, center); double miles = distance.getMiles(); if (miles > max) { max = miles; } } return max; }
java
@Unit(NM) public static double radius(Location... location) { Location center = center(location); double max = 0; for (Location loc : location) { Distance distance = distance(loc, center); double miles = distance.getMiles(); if (miles > max) { max = miles; } } return max; }
[ "@", "Unit", "(", "NM", ")", "public", "static", "double", "radius", "(", "Location", "...", "location", ")", "{", "Location", "center", "=", "center", "(", "location", ")", ";", "double", "max", "=", "0", ";", "for", "(", "Location", "loc", ":", "location", ")", "{", "Distance", "distance", "=", "distance", "(", "loc", ",", "center", ")", ";", "double", "miles", "=", "distance", ".", "getMiles", "(", ")", ";", "if", "(", "miles", ">", "max", ")", "{", "max", "=", "miles", ";", "}", "}", "return", "max", ";", "}" ]
First calculates center point and returns maximum distance from center in NM. @param location @return
[ "First", "calculates", "center", "point", "and", "returns", "maximum", "distance", "from", "center", "in", "NM", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/Location.java#L280-L295
154,279
isisaddons-legacy/isis-module-publishing
dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java
PublishingServiceRepository.findQueued
@Programmatic public List<PublishedEvent> findQueued() { return repositoryService.allMatches( new QueryDefault<>(PublishedEvent.class, "findByStateOrderByTimestamp", "state", PublishedEvent.State.QUEUED)); }
java
@Programmatic public List<PublishedEvent> findQueued() { return repositoryService.allMatches( new QueryDefault<>(PublishedEvent.class, "findByStateOrderByTimestamp", "state", PublishedEvent.State.QUEUED)); }
[ "@", "Programmatic", "public", "List", "<", "PublishedEvent", ">", "findQueued", "(", ")", "{", "return", "repositoryService", ".", "allMatches", "(", "new", "QueryDefault", "<>", "(", "PublishedEvent", ".", "class", ",", "\"findByStateOrderByTimestamp\"", ",", "\"state\"", ",", "PublishedEvent", ".", "State", ".", "QUEUED", ")", ")", ";", "}" ]
region > findQueued
[ "region", ">", "findQueued" ]
9f13eab061156b70ccefd2418346dace612c1de0
https://github.com/isisaddons-legacy/isis-module-publishing/blob/9f13eab061156b70ccefd2418346dace612c1de0/dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java#L53-L59
154,280
isisaddons-legacy/isis-module-publishing
dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java
PublishingServiceRepository.findProcessed
@Programmatic public List<PublishedEvent> findProcessed() { return repositoryService.allMatches( new QueryDefault<>(PublishedEvent.class, "findByStateOrderByTimestamp", "state", PublishedEvent.State.PROCESSED)); }
java
@Programmatic public List<PublishedEvent> findProcessed() { return repositoryService.allMatches( new QueryDefault<>(PublishedEvent.class, "findByStateOrderByTimestamp", "state", PublishedEvent.State.PROCESSED)); }
[ "@", "Programmatic", "public", "List", "<", "PublishedEvent", ">", "findProcessed", "(", ")", "{", "return", "repositoryService", ".", "allMatches", "(", "new", "QueryDefault", "<>", "(", "PublishedEvent", ".", "class", ",", "\"findByStateOrderByTimestamp\"", ",", "\"state\"", ",", "PublishedEvent", ".", "State", ".", "PROCESSED", ")", ")", ";", "}" ]
region > findProcessed
[ "region", ">", "findProcessed" ]
9f13eab061156b70ccefd2418346dace612c1de0
https://github.com/isisaddons-legacy/isis-module-publishing/blob/9f13eab061156b70ccefd2418346dace612c1de0/dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java#L65-L71
154,281
isisaddons-legacy/isis-module-publishing
dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java
PublishingServiceRepository.purgeProcessed
@Programmatic public void purgeProcessed() { // REVIEW: this is not particularly performant. // much better would be to go direct to the JDO API. List<PublishedEvent> processedEvents = findProcessed(); for (PublishedEvent publishedEvent : processedEvents) { publishedEvent.delete(); } }
java
@Programmatic public void purgeProcessed() { // REVIEW: this is not particularly performant. // much better would be to go direct to the JDO API. List<PublishedEvent> processedEvents = findProcessed(); for (PublishedEvent publishedEvent : processedEvents) { publishedEvent.delete(); } }
[ "@", "Programmatic", "public", "void", "purgeProcessed", "(", ")", "{", "// REVIEW: this is not particularly performant.", "// much better would be to go direct to the JDO API.", "List", "<", "PublishedEvent", ">", "processedEvents", "=", "findProcessed", "(", ")", ";", "for", "(", "PublishedEvent", "publishedEvent", ":", "processedEvents", ")", "{", "publishedEvent", ".", "delete", "(", ")", ";", "}", "}" ]
region > purgeProcessed
[ "region", ">", "purgeProcessed" ]
9f13eab061156b70ccefd2418346dace612c1de0
https://github.com/isisaddons-legacy/isis-module-publishing/blob/9f13eab061156b70ccefd2418346dace612c1de0/dom/src/main/java/org/isisaddons/module/publishing/dom/PublishingServiceRepository.java#L89-L97
154,282
jbundle/jbundle
thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java
JHtmlView.getURLFromPath
public static URL getURLFromPath(String path, BaseApplet applet) { URL url = null; try { if ((url == null) && (path != null)) url = new URL(path); } catch (MalformedURLException ex) { Application app = null; if (applet == null) applet = (BaseApplet)BaseApplet.getSharedInstance().getApplet(); if (applet != null) app = applet.getApplication(); if ((app != null) && (url == null) && (path != null)) url = app.getResourceURL(path, applet); else ex.printStackTrace(); } return url; }
java
public static URL getURLFromPath(String path, BaseApplet applet) { URL url = null; try { if ((url == null) && (path != null)) url = new URL(path); } catch (MalformedURLException ex) { Application app = null; if (applet == null) applet = (BaseApplet)BaseApplet.getSharedInstance().getApplet(); if (applet != null) app = applet.getApplication(); if ((app != null) && (url == null) && (path != null)) url = app.getResourceURL(path, applet); else ex.printStackTrace(); } return url; }
[ "public", "static", "URL", "getURLFromPath", "(", "String", "path", ",", "BaseApplet", "applet", ")", "{", "URL", "url", "=", "null", ";", "try", "{", "if", "(", "(", "url", "==", "null", ")", "&&", "(", "path", "!=", "null", ")", ")", "url", "=", "new", "URL", "(", "path", ")", ";", "}", "catch", "(", "MalformedURLException", "ex", ")", "{", "Application", "app", "=", "null", ";", "if", "(", "applet", "==", "null", ")", "applet", "=", "(", "BaseApplet", ")", "BaseApplet", ".", "getSharedInstance", "(", ")", ".", "getApplet", "(", ")", ";", "if", "(", "applet", "!=", "null", ")", "app", "=", "applet", ".", "getApplication", "(", ")", ";", "if", "(", "(", "app", "!=", "null", ")", "&&", "(", "url", "==", "null", ")", "&&", "(", "path", "!=", "null", ")", ")", "url", "=", "app", ".", "getResourceURL", "(", "path", ",", "applet", ")", ";", "else", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "url", ";", "}" ]
Get the URL from the path. @param The resource path. @return The URL.
[ "Get", "the", "URL", "from", "the", "path", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java#L110-L128
154,283
tvesalainen/util
util/src/main/java/org/vesalainen/nio/SynchronizedRingByteBuffer.java
SynchronizedRingByteBuffer.tryFillAll
public int tryFillAll(RingByteBuffer ring) throws IOException, InterruptedException { fillLock.lock(); try { if (ring.marked() > free()) { return 0; } return fill(ring); } finally { fillLock.unlock(); } }
java
public int tryFillAll(RingByteBuffer ring) throws IOException, InterruptedException { fillLock.lock(); try { if (ring.marked() > free()) { return 0; } return fill(ring); } finally { fillLock.unlock(); } }
[ "public", "int", "tryFillAll", "(", "RingByteBuffer", "ring", ")", "throws", "IOException", ",", "InterruptedException", "{", "fillLock", ".", "lock", "(", ")", ";", "try", "{", "if", "(", "ring", ".", "marked", "(", ")", ">", "free", "(", ")", ")", "{", "return", "0", ";", "}", "return", "fill", "(", "ring", ")", ";", "}", "finally", "{", "fillLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Calls fill if rings marked fits. Otherwise returns 0. @param ring @return @throws IOException @throws InterruptedException
[ "Calls", "fill", "if", "rings", "marked", "fits", ".", "Otherwise", "returns", "0", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/SynchronizedRingByteBuffer.java#L138-L153
154,284
tvesalainen/util
util/src/main/java/org/vesalainen/nio/SynchronizedRingByteBuffer.java
SynchronizedRingByteBuffer.fillAll
public int fillAll(RingByteBuffer ring) throws IOException, InterruptedException { if (ring.marked() > capacity) { throw new IllegalArgumentException("marked > capacity"); } fillLock.lock(); try { fillSync.waitUntil(()->ring.marked()<=free()); return fill(ring); } finally { fillLock.unlock(); } }
java
public int fillAll(RingByteBuffer ring) throws IOException, InterruptedException { if (ring.marked() > capacity) { throw new IllegalArgumentException("marked > capacity"); } fillLock.lock(); try { fillSync.waitUntil(()->ring.marked()<=free()); return fill(ring); } finally { fillLock.unlock(); } }
[ "public", "int", "fillAll", "(", "RingByteBuffer", "ring", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "ring", ".", "marked", "(", ")", ">", "capacity", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"marked > capacity\"", ")", ";", "}", "fillLock", ".", "lock", "(", ")", ";", "try", "{", "fillSync", ".", "waitUntil", "(", "(", ")", "->", "ring", ".", "marked", "(", ")", "<=", "free", "(", ")", ")", ";", "return", "fill", "(", "ring", ")", ";", "}", "finally", "{", "fillLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Waits until ring.marked fits. @param ring @return @throws IOException @throws InterruptedException
[ "Waits", "until", "ring", ".", "marked", "fits", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/SynchronizedRingByteBuffer.java#L161-L177
154,285
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/Node.java
Node.getSpacer
protected String getSpacer() { final StringBuilder output = new StringBuilder(); final int indentationSize = parent != null ? getColumn() : 0; for (int i = 1; i < indentationSize; i++) { output.append(SPACER); } return output.toString(); }
java
protected String getSpacer() { final StringBuilder output = new StringBuilder(); final int indentationSize = parent != null ? getColumn() : 0; for (int i = 1; i < indentationSize; i++) { output.append(SPACER); } return output.toString(); }
[ "protected", "String", "getSpacer", "(", ")", "{", "final", "StringBuilder", "output", "=", "new", "StringBuilder", "(", ")", ";", "final", "int", "indentationSize", "=", "parent", "!=", "null", "?", "getColumn", "(", ")", ":", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "indentationSize", ";", "i", "++", ")", "{", "output", ".", "append", "(", "SPACER", ")", ";", "}", "return", "output", ".", "toString", "(", ")", ";", "}" ]
Gets the spacer string to append before nodes in their toString methods. @return A string containing the amount of space to use for the node.
[ "Gets", "the", "spacer", "string", "to", "append", "before", "nodes", "in", "their", "toString", "methods", "." ]
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/Node.java#L167-L174
154,286
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java
BaseMessageProcessor.init
public void init(RecordOwnerParent taskParent, Record recordMain, Map<String, Object> properties) { m_trxMessage = null; if (properties != null) // NOTE: I remove message from the properties m_trxMessage = (BaseMessage)properties.remove(DBParams.MESSAGE); super.init(taskParent, recordMain, properties); }
java
public void init(RecordOwnerParent taskParent, Record recordMain, Map<String, Object> properties) { m_trxMessage = null; if (properties != null) // NOTE: I remove message from the properties m_trxMessage = (BaseMessage)properties.remove(DBParams.MESSAGE); super.init(taskParent, recordMain, properties); }
[ "public", "void", "init", "(", "RecordOwnerParent", "taskParent", ",", "Record", "recordMain", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "m_trxMessage", "=", "null", ";", "if", "(", "properties", "!=", "null", ")", "// NOTE: I remove message from the properties", "m_trxMessage", "=", "(", "BaseMessage", ")", "properties", ".", "remove", "(", "DBParams", ".", "MESSAGE", ")", ";", "super", ".", "init", "(", "taskParent", ",", "recordMain", ",", "properties", ")", ";", "}" ]
Initializes the MessageProcessor.
[ "Initializes", "the", "MessageProcessor", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java#L63-L69
154,287
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java
BaseMessageProcessor.getRegistryID
public Integer getRegistryID(BaseMessage internalMessageReply) { Integer intRegistryID = null; Object objRegistryID = null; if (internalMessageReply.getMessageHeader() instanceof TrxMessageHeader) // Always objRegistryID = ((TrxMessageHeader)internalMessageReply.getMessageHeader()).getMessageHeaderMap().get(TrxMessageHeader.REGISTRY_ID); if (objRegistryID == null) objRegistryID = internalMessageReply.get(TrxMessageHeader.REGISTRY_ID); if (objRegistryID instanceof Integer) intRegistryID = (Integer)objRegistryID; else if (objRegistryID instanceof String) { try { intRegistryID = new Integer(Integer.parseInt((String)objRegistryID)); } catch (NumberFormatException ex) { intRegistryID = null; } } return intRegistryID; }
java
public Integer getRegistryID(BaseMessage internalMessageReply) { Integer intRegistryID = null; Object objRegistryID = null; if (internalMessageReply.getMessageHeader() instanceof TrxMessageHeader) // Always objRegistryID = ((TrxMessageHeader)internalMessageReply.getMessageHeader()).getMessageHeaderMap().get(TrxMessageHeader.REGISTRY_ID); if (objRegistryID == null) objRegistryID = internalMessageReply.get(TrxMessageHeader.REGISTRY_ID); if (objRegistryID instanceof Integer) intRegistryID = (Integer)objRegistryID; else if (objRegistryID instanceof String) { try { intRegistryID = new Integer(Integer.parseInt((String)objRegistryID)); } catch (NumberFormatException ex) { intRegistryID = null; } } return intRegistryID; }
[ "public", "Integer", "getRegistryID", "(", "BaseMessage", "internalMessageReply", ")", "{", "Integer", "intRegistryID", "=", "null", ";", "Object", "objRegistryID", "=", "null", ";", "if", "(", "internalMessageReply", ".", "getMessageHeader", "(", ")", "instanceof", "TrxMessageHeader", ")", "// Always", "objRegistryID", "=", "(", "(", "TrxMessageHeader", ")", "internalMessageReply", ".", "getMessageHeader", "(", ")", ")", ".", "getMessageHeaderMap", "(", ")", ".", "get", "(", "TrxMessageHeader", ".", "REGISTRY_ID", ")", ";", "if", "(", "objRegistryID", "==", "null", ")", "objRegistryID", "=", "internalMessageReply", ".", "get", "(", "TrxMessageHeader", ".", "REGISTRY_ID", ")", ";", "if", "(", "objRegistryID", "instanceof", "Integer", ")", "intRegistryID", "=", "(", "Integer", ")", "objRegistryID", ";", "else", "if", "(", "objRegistryID", "instanceof", "String", ")", "{", "try", "{", "intRegistryID", "=", "new", "Integer", "(", "Integer", ".", "parseInt", "(", "(", "String", ")", "objRegistryID", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "ex", ")", "{", "intRegistryID", "=", "null", ";", "}", "}", "return", "intRegistryID", ";", "}" ]
Get the message queue registry ID from this message. @param internalMessage The message to get the registry ID from. @return Integer The registry ID.
[ "Get", "the", "message", "queue", "registry", "ID", "from", "this", "message", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/processor/BaseMessageProcessor.java#L137-L156
154,288
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java
AskBuilder.answer
public <T> T answer(Function<String, T> function, final String validationErrorMessage) { validateWith(functionValidator(function, validationErrorMessage)); return function.apply(answer()); }
java
public <T> T answer(Function<String, T> function, final String validationErrorMessage) { validateWith(functionValidator(function, validationErrorMessage)); return function.apply(answer()); }
[ "public", "<", "T", ">", "T", "answer", "(", "Function", "<", "String", ",", "T", ">", "function", ",", "final", "String", "validationErrorMessage", ")", "{", "validateWith", "(", "functionValidator", "(", "function", ",", "validationErrorMessage", ")", ")", ";", "return", "function", ".", "apply", "(", "answer", "(", ")", ")", ";", "}" ]
Return user input as T @param function {@link Function} or {@link de.eleon.console.builder.functional.Transformer} for value conversion @param validationErrorMessage error message if function conversion fails @param <T> the return type @return user input as T
[ "Return", "user", "input", "as", "T" ]
814bee4a1a812a3a39a9b239e5eccb525b944e65
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java#L135-L138
154,289
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java
AskBuilder.initConsoleAndGetAnswer
private String initConsoleAndGetAnswer() { ConsoleReaderWrapper consoleReaderWrapper = initConsole(); String input = ""; boolean valid = false; while (!valid) { input = consoleReaderWrapper.getInput(); valid = validate(consoleReaderWrapper, input); if (!valid) { consoleReaderWrapper.print(""); consoleReaderWrapper.print(question); } } consoleReaderWrapper.close(); return input; }
java
private String initConsoleAndGetAnswer() { ConsoleReaderWrapper consoleReaderWrapper = initConsole(); String input = ""; boolean valid = false; while (!valid) { input = consoleReaderWrapper.getInput(); valid = validate(consoleReaderWrapper, input); if (!valid) { consoleReaderWrapper.print(""); consoleReaderWrapper.print(question); } } consoleReaderWrapper.close(); return input; }
[ "private", "String", "initConsoleAndGetAnswer", "(", ")", "{", "ConsoleReaderWrapper", "consoleReaderWrapper", "=", "initConsole", "(", ")", ";", "String", "input", "=", "\"\"", ";", "boolean", "valid", "=", "false", ";", "while", "(", "!", "valid", ")", "{", "input", "=", "consoleReaderWrapper", ".", "getInput", "(", ")", ";", "valid", "=", "validate", "(", "consoleReaderWrapper", ",", "input", ")", ";", "if", "(", "!", "valid", ")", "{", "consoleReaderWrapper", ".", "print", "(", "\"\"", ")", ";", "consoleReaderWrapper", ".", "print", "(", "question", ")", ";", "}", "}", "consoleReaderWrapper", ".", "close", "(", ")", ";", "return", "input", ";", "}" ]
Initialize console and get user input as answer @return user input as String
[ "Initialize", "console", "and", "get", "user", "input", "as", "answer" ]
814bee4a1a812a3a39a9b239e5eccb525b944e65
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java#L170-L188
154,290
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java
AskBuilder.validate
private boolean validate(ConsoleReaderWrapper consoleReaderWrapper, String input) { Iterable<String> errors = validate(input); if (!Iterables.isEmpty(errors)) { consoleReaderWrapper.beep(); for (String error : errors) { consoleReaderWrapper.print(error); } return false; } else { return true; } }
java
private boolean validate(ConsoleReaderWrapper consoleReaderWrapper, String input) { Iterable<String> errors = validate(input); if (!Iterables.isEmpty(errors)) { consoleReaderWrapper.beep(); for (String error : errors) { consoleReaderWrapper.print(error); } return false; } else { return true; } }
[ "private", "boolean", "validate", "(", "ConsoleReaderWrapper", "consoleReaderWrapper", ",", "String", "input", ")", "{", "Iterable", "<", "String", ">", "errors", "=", "validate", "(", "input", ")", ";", "if", "(", "!", "Iterables", ".", "isEmpty", "(", "errors", ")", ")", "{", "consoleReaderWrapper", ".", "beep", "(", ")", ";", "for", "(", "String", "error", ":", "errors", ")", "{", "consoleReaderWrapper", ".", "print", "(", "error", ")", ";", "}", "return", "false", ";", "}", "else", "{", "return", "true", ";", "}", "}" ]
Validate user input with available validators @param consoleReaderWrapper Console to print errir messages @param input User input as String @return boolean of validation result. valid == true
[ "Validate", "user", "input", "with", "available", "validators" ]
814bee4a1a812a3a39a9b239e5eccb525b944e65
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java#L215-L226
154,291
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.init
public void init(Object env, Map<String,Object> properties, Object applet) { super.init(env, properties, applet); Task task = new AutoTask(this, null, null); // This is the base task for this application m_systemRecordOwner = (RecordOwner)ClassServiceUtility.getClassService().makeObjectFromClassName(ResourceConstants.BASE_PROCESS_CLASS); m_systemRecordOwner.init(task, null, null); //x this.readUserInfo(); String strUser = this.getProperty(Params.USER_ID); if (strUser == null) strUser = this.getProperty(Params.USER_NAME); if (this.login(task, strUser, this.getProperty(Params.PASSWORD), this.getProperty(Params.DOMAIN)) != DBConstants.NORMAL_RETURN) // Note, even if the username is null, I need to log in. this.login(task, null, null, this.getProperty(Params.DOMAIN)); // If bad login, do anonymous login }
java
public void init(Object env, Map<String,Object> properties, Object applet) { super.init(env, properties, applet); Task task = new AutoTask(this, null, null); // This is the base task for this application m_systemRecordOwner = (RecordOwner)ClassServiceUtility.getClassService().makeObjectFromClassName(ResourceConstants.BASE_PROCESS_CLASS); m_systemRecordOwner.init(task, null, null); //x this.readUserInfo(); String strUser = this.getProperty(Params.USER_ID); if (strUser == null) strUser = this.getProperty(Params.USER_NAME); if (this.login(task, strUser, this.getProperty(Params.PASSWORD), this.getProperty(Params.DOMAIN)) != DBConstants.NORMAL_RETURN) // Note, even if the username is null, I need to log in. this.login(task, null, null, this.getProperty(Params.DOMAIN)); // If bad login, do anonymous login }
[ "public", "void", "init", "(", "Object", "env", ",", "Map", "<", "String", ",", "Object", ">", "properties", ",", "Object", "applet", ")", "{", "super", ".", "init", "(", "env", ",", "properties", ",", "applet", ")", ";", "Task", "task", "=", "new", "AutoTask", "(", "this", ",", "null", ",", "null", ")", ";", "// This is the base task for this application", "m_systemRecordOwner", "=", "(", "RecordOwner", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "ResourceConstants", ".", "BASE_PROCESS_CLASS", ")", ";", "m_systemRecordOwner", ".", "init", "(", "task", ",", "null", ",", "null", ")", ";", "//x this.readUserInfo();", "String", "strUser", "=", "this", ".", "getProperty", "(", "Params", ".", "USER_ID", ")", ";", "if", "(", "strUser", "==", "null", ")", "strUser", "=", "this", ".", "getProperty", "(", "Params", ".", "USER_NAME", ")", ";", "if", "(", "this", ".", "login", "(", "task", ",", "strUser", ",", "this", ".", "getProperty", "(", "Params", ".", "PASSWORD", ")", ",", "this", ".", "getProperty", "(", "Params", ".", "DOMAIN", ")", ")", "!=", "DBConstants", ".", "NORMAL_RETURN", ")", "// Note, even if the username is null, I need to log in.", "this", ".", "login", "(", "task", ",", "null", ",", "null", ",", "this", ".", "getProperty", "(", "Params", ".", "DOMAIN", ")", ")", ";", "// If bad login, do anonymous login", "}" ]
Initializes the MainApplication. Usually you pass the object that wants to use this sesssion. For example, the applet or MainApplication. @param env The Environment. @param strURL The application parameters as a URL. @param args The application parameters as an initial arg list. @param applet The application parameters coming from an applet.
[ "Initializes", "the", "MainApplication", ".", "Usually", "you", "pass", "the", "object", "that", "wants", "to", "use", "this", "sesssion", ".", "For", "example", "the", "applet", "or", "MainApplication", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L86-L100
154,292
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.free
public void free() { Record recUserRegistration = (Record)m_systemRecordOwner.getRecord(UserRegistrationModel.USER_REGISTRATION_FILE); if (recUserRegistration != null) { for (UserProperties regKey : m_htRegistration.values()) { regKey.free(); // Remove yourself } recUserRegistration.free(); recUserRegistration = null; } Record recUserInfo = (Record)this.getUserInfo(); if (recUserInfo != null) { if (recUserInfo.isModified(false)) { try { if (recUserInfo.getEditMode() == Constants.EDIT_ADD) recUserInfo.add(); else recUserInfo.set(); } catch (DBException ex) { ex.printStackTrace(); } } recUserInfo.free(); recUserInfo = null; } super.free(); }
java
public void free() { Record recUserRegistration = (Record)m_systemRecordOwner.getRecord(UserRegistrationModel.USER_REGISTRATION_FILE); if (recUserRegistration != null) { for (UserProperties regKey : m_htRegistration.values()) { regKey.free(); // Remove yourself } recUserRegistration.free(); recUserRegistration = null; } Record recUserInfo = (Record)this.getUserInfo(); if (recUserInfo != null) { if (recUserInfo.isModified(false)) { try { if (recUserInfo.getEditMode() == Constants.EDIT_ADD) recUserInfo.add(); else recUserInfo.set(); } catch (DBException ex) { ex.printStackTrace(); } } recUserInfo.free(); recUserInfo = null; } super.free(); }
[ "public", "void", "free", "(", ")", "{", "Record", "recUserRegistration", "=", "(", "Record", ")", "m_systemRecordOwner", ".", "getRecord", "(", "UserRegistrationModel", ".", "USER_REGISTRATION_FILE", ")", ";", "if", "(", "recUserRegistration", "!=", "null", ")", "{", "for", "(", "UserProperties", "regKey", ":", "m_htRegistration", ".", "values", "(", ")", ")", "{", "regKey", ".", "free", "(", ")", ";", "// Remove yourself ", "}", "recUserRegistration", ".", "free", "(", ")", ";", "recUserRegistration", "=", "null", ";", "}", "Record", "recUserInfo", "=", "(", "Record", ")", "this", ".", "getUserInfo", "(", ")", ";", "if", "(", "recUserInfo", "!=", "null", ")", "{", "if", "(", "recUserInfo", ".", "isModified", "(", "false", ")", ")", "{", "try", "{", "if", "(", "recUserInfo", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_ADD", ")", "recUserInfo", ".", "add", "(", ")", ";", "else", "recUserInfo", ".", "set", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "recUserInfo", ".", "free", "(", ")", ";", "recUserInfo", "=", "null", ";", "}", "super", ".", "free", "(", ")", ";", "}" ]
Release the user's preferences.
[ "Release", "the", "user", "s", "preferences", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L104-L136
154,293
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.getDefaultSystemName
public String getDefaultSystemName() { // No system name set, check the base menus for domain or default properties Environment env = this.getEnvironment(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(DBConstants.SYSTEM_NAME, "base"); BaseApplication app = new MainApplication(env, properties, null); try { Task task = new AutoTask(app, null, properties); RecordOwner recordOwner = new BaseProcess(task, null, properties); Record menus = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, recordOwner); menus.getField(Menus.CODE).setString(ResourceConstants.DEFAULT_RESOURCE); menus.setKeyArea(MenusModel.CODE_KEY); if (menus.seek(null)) return ((PropertiesField)menus.getField(Menus.PARAMS)).getProperty(DBConstants.SYSTEM_NAME); } catch (DBException e) { e.printStackTrace(); } finally { env.removeApplication(app); app.setEnvironment(null); app.free(); } return Utility.DEFAULT_SYSTEM_SUFFIX; }
java
public String getDefaultSystemName() { // No system name set, check the base menus for domain or default properties Environment env = this.getEnvironment(); Map<String, Object> properties = new HashMap<String, Object>(); properties.put(DBConstants.SYSTEM_NAME, "base"); BaseApplication app = new MainApplication(env, properties, null); try { Task task = new AutoTask(app, null, properties); RecordOwner recordOwner = new BaseProcess(task, null, properties); Record menus = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, recordOwner); menus.getField(Menus.CODE).setString(ResourceConstants.DEFAULT_RESOURCE); menus.setKeyArea(MenusModel.CODE_KEY); if (menus.seek(null)) return ((PropertiesField)menus.getField(Menus.PARAMS)).getProperty(DBConstants.SYSTEM_NAME); } catch (DBException e) { e.printStackTrace(); } finally { env.removeApplication(app); app.setEnvironment(null); app.free(); } return Utility.DEFAULT_SYSTEM_SUFFIX; }
[ "public", "String", "getDefaultSystemName", "(", ")", "{", "// No system name set, check the base menus for domain or default properties", "Environment", "env", "=", "this", ".", "getEnvironment", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "properties", ".", "put", "(", "DBConstants", ".", "SYSTEM_NAME", ",", "\"base\"", ")", ";", "BaseApplication", "app", "=", "new", "MainApplication", "(", "env", ",", "properties", ",", "null", ")", ";", "try", "{", "Task", "task", "=", "new", "AutoTask", "(", "app", ",", "null", ",", "properties", ")", ";", "RecordOwner", "recordOwner", "=", "new", "BaseProcess", "(", "task", ",", "null", ",", "properties", ")", ";", "Record", "menus", "=", "Record", ".", "makeRecordFromClassName", "(", "MenusModel", ".", "THICK_CLASS", ",", "recordOwner", ")", ";", "menus", ".", "getField", "(", "Menus", ".", "CODE", ")", ".", "setString", "(", "ResourceConstants", ".", "DEFAULT_RESOURCE", ")", ";", "menus", ".", "setKeyArea", "(", "MenusModel", ".", "CODE_KEY", ")", ";", "if", "(", "menus", ".", "seek", "(", "null", ")", ")", "return", "(", "(", "PropertiesField", ")", "menus", ".", "getField", "(", "Menus", ".", "PARAMS", ")", ")", ".", "getProperty", "(", "DBConstants", ".", "SYSTEM_NAME", ")", ";", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "env", ".", "removeApplication", "(", "app", ")", ";", "app", ".", "setEnvironment", "(", "null", ")", ";", "app", ".", "free", "(", ")", ";", "}", "return", "Utility", ".", "DEFAULT_SYSTEM_SUFFIX", ";", "}" ]
Read the default system name. @return
[ "Read", "the", "default", "system", "name", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L199-L221
154,294
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.addMenuProperties
public Map<String,Object> addMenuProperties(String strSubDomain, Record recMenus, Map<String,Object> mapDomainProperties) { try { recMenus.getField(Menus.CODE).setString(strSubDomain); if (recMenus.seek("=")) { Map<String,Object> properties = ((PropertiesField)recMenus.getField(Menus.PARAMS)).getProperties(); if (properties == null) properties = new HashMap<String,Object>(); if (properties.get(DBParams.HOME) == null) properties.put(DBParams.HOME, strSubDomain); Map<String,Object> oldProperties = m_systemRecordOwner.getProperties(); m_systemRecordOwner.setProperties(properties); // All I want are the db (global) properties. properties = BaseDatabase.addDBProperties(null, m_systemRecordOwner, null); m_systemRecordOwner.setProperties(oldProperties); if (mapDomainProperties == null) mapDomainProperties = properties; else { properties.putAll(mapDomainProperties); mapDomainProperties = properties; } } } catch (DBException ex) { ex.printStackTrace(); } return mapDomainProperties; }
java
public Map<String,Object> addMenuProperties(String strSubDomain, Record recMenus, Map<String,Object> mapDomainProperties) { try { recMenus.getField(Menus.CODE).setString(strSubDomain); if (recMenus.seek("=")) { Map<String,Object> properties = ((PropertiesField)recMenus.getField(Menus.PARAMS)).getProperties(); if (properties == null) properties = new HashMap<String,Object>(); if (properties.get(DBParams.HOME) == null) properties.put(DBParams.HOME, strSubDomain); Map<String,Object> oldProperties = m_systemRecordOwner.getProperties(); m_systemRecordOwner.setProperties(properties); // All I want are the db (global) properties. properties = BaseDatabase.addDBProperties(null, m_systemRecordOwner, null); m_systemRecordOwner.setProperties(oldProperties); if (mapDomainProperties == null) mapDomainProperties = properties; else { properties.putAll(mapDomainProperties); mapDomainProperties = properties; } } } catch (DBException ex) { ex.printStackTrace(); } return mapDomainProperties; }
[ "public", "Map", "<", "String", ",", "Object", ">", "addMenuProperties", "(", "String", "strSubDomain", ",", "Record", "recMenus", ",", "Map", "<", "String", ",", "Object", ">", "mapDomainProperties", ")", "{", "try", "{", "recMenus", ".", "getField", "(", "Menus", ".", "CODE", ")", ".", "setString", "(", "strSubDomain", ")", ";", "if", "(", "recMenus", ".", "seek", "(", "\"=\"", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "properties", "=", "(", "(", "PropertiesField", ")", "recMenus", ".", "getField", "(", "Menus", ".", "PARAMS", ")", ")", ".", "getProperties", "(", ")", ";", "if", "(", "properties", "==", "null", ")", "properties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "properties", ".", "get", "(", "DBParams", ".", "HOME", ")", "==", "null", ")", "properties", ".", "put", "(", "DBParams", ".", "HOME", ",", "strSubDomain", ")", ";", "Map", "<", "String", ",", "Object", ">", "oldProperties", "=", "m_systemRecordOwner", ".", "getProperties", "(", ")", ";", "m_systemRecordOwner", ".", "setProperties", "(", "properties", ")", ";", "// All I want are the db (global) properties.", "properties", "=", "BaseDatabase", ".", "addDBProperties", "(", "null", ",", "m_systemRecordOwner", ",", "null", ")", ";", "m_systemRecordOwner", ".", "setProperties", "(", "oldProperties", ")", ";", "if", "(", "mapDomainProperties", "==", "null", ")", "mapDomainProperties", "=", "properties", ";", "else", "{", "properties", ".", "putAll", "(", "mapDomainProperties", ")", ";", "mapDomainProperties", "=", "properties", ";", "}", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "return", "mapDomainProperties", ";", "}" ]
Add the properies from this menu item. @param strSubDomain The menu item @param recMenus The menu record @param mapDomainProperties The properties to add to. @return The new properties (actually mapDomainProperties updated)
[ "Add", "the", "properies", "from", "this", "menu", "item", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L229-L257
154,295
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.setDomainProperties
public Map<String,Object> setDomainProperties(Task task, String strDomain) { Map<String,Object> mapDomainProperties = null; if (strDomain != null) { // Special case - Main URL menu (Save properties) if (m_systemRecordOwner != null) { // Always mapDomainProperties = this.getDomainProperties(strDomain); if (mapDomainProperties != null) if (((mapDomainProperties.get(DBConstants.DB_USER_PREFIX) != null) && (!mapDomainProperties.get(DBConstants.DB_USER_PREFIX).equals(m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX)))) || ((m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX) != null) && (!m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX).equals(mapDomainProperties.get(DBConstants.DB_USER_PREFIX))))) { m_systemRecordOwner.free(); m_databaseCollection.free(); m_databaseCollection = new DatabaseCollection(this); m_systemRecordOwner = (RecordOwner)ClassServiceUtility.getClassService().makeObjectFromClassName(ResourceConstants.BASE_PROCESS_CLASS); m_systemRecordOwner.init(task, null, null); } m_systemRecordOwner.setProperties(mapDomainProperties);// Note: I know this is overwritten at the end of this method, BUT I DO NEED these properties NOW if Db_prefix was changed } } return mapDomainProperties; }
java
public Map<String,Object> setDomainProperties(Task task, String strDomain) { Map<String,Object> mapDomainProperties = null; if (strDomain != null) { // Special case - Main URL menu (Save properties) if (m_systemRecordOwner != null) { // Always mapDomainProperties = this.getDomainProperties(strDomain); if (mapDomainProperties != null) if (((mapDomainProperties.get(DBConstants.DB_USER_PREFIX) != null) && (!mapDomainProperties.get(DBConstants.DB_USER_PREFIX).equals(m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX)))) || ((m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX) != null) && (!m_systemRecordOwner.getProperty(DBConstants.DB_USER_PREFIX).equals(mapDomainProperties.get(DBConstants.DB_USER_PREFIX))))) { m_systemRecordOwner.free(); m_databaseCollection.free(); m_databaseCollection = new DatabaseCollection(this); m_systemRecordOwner = (RecordOwner)ClassServiceUtility.getClassService().makeObjectFromClassName(ResourceConstants.BASE_PROCESS_CLASS); m_systemRecordOwner.init(task, null, null); } m_systemRecordOwner.setProperties(mapDomainProperties);// Note: I know this is overwritten at the end of this method, BUT I DO NEED these properties NOW if Db_prefix was changed } } return mapDomainProperties; }
[ "public", "Map", "<", "String", ",", "Object", ">", "setDomainProperties", "(", "Task", "task", ",", "String", "strDomain", ")", "{", "Map", "<", "String", ",", "Object", ">", "mapDomainProperties", "=", "null", ";", "if", "(", "strDomain", "!=", "null", ")", "{", "// Special case - Main URL menu (Save properties)", "if", "(", "m_systemRecordOwner", "!=", "null", ")", "{", "// Always", "mapDomainProperties", "=", "this", ".", "getDomainProperties", "(", "strDomain", ")", ";", "if", "(", "mapDomainProperties", "!=", "null", ")", "if", "(", "(", "(", "mapDomainProperties", ".", "get", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", "!=", "null", ")", "&&", "(", "!", "mapDomainProperties", ".", "get", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", ".", "equals", "(", "m_systemRecordOwner", ".", "getProperty", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", ")", ")", ")", "||", "(", "(", "m_systemRecordOwner", ".", "getProperty", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", "!=", "null", ")", "&&", "(", "!", "m_systemRecordOwner", ".", "getProperty", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", ".", "equals", "(", "mapDomainProperties", ".", "get", "(", "DBConstants", ".", "DB_USER_PREFIX", ")", ")", ")", ")", ")", "{", "m_systemRecordOwner", ".", "free", "(", ")", ";", "m_databaseCollection", ".", "free", "(", ")", ";", "m_databaseCollection", "=", "new", "DatabaseCollection", "(", "this", ")", ";", "m_systemRecordOwner", "=", "(", "RecordOwner", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "ResourceConstants", ".", "BASE_PROCESS_CLASS", ")", ";", "m_systemRecordOwner", ".", "init", "(", "task", ",", "null", ",", "null", ")", ";", "}", "m_systemRecordOwner", ".", "setProperties", "(", "mapDomainProperties", ")", ";", "// Note: I know this is overwritten at the end of this method, BUT I DO NEED these properties NOW if Db_prefix was changed", "}", "}", "return", "mapDomainProperties", ";", "}" ]
If the domain changes, change the properties to the new domain. @param task @param strDomain @return
[ "If", "the", "domain", "changes", "change", "the", "properties", "to", "the", "new", "domain", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L391-L413
154,296
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.readUserInfo
public boolean readUserInfo(boolean bRefreshOnChange, boolean bForceRead) { String strUserID = this.getProperty(DBParams.USER_ID); if (strUserID == null) strUserID = this.getProperty(DBParams.USER_NAME); if (strUserID == null) strUserID = Constants.BLANK; Record recUserInfo = (Record)this.getUserInfo(); if (recUserInfo == null) recUserInfo = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, m_systemRecordOwner); else { try { if (recUserInfo.getEditMode() == DBConstants.EDIT_IN_PROGRESS) if (recUserInfo.isModified()) { int iID = (int)recUserInfo.getCounterField().getValue(); recUserInfo.set(); // Update the current record. if (iID != recUserInfo.getCounterField().getValue()) this.setProperty(DBParams.USER_ID, recUserInfo.getCounterField().toString()); } } catch (DBException ex) { ex.printStackTrace(); } } boolean bFound = ((UserInfoModel)recUserInfo).getUserInfo(strUserID, bForceRead); // This will read using either the userID or the user name if (!bFound) { // Not found, add new int iOpenMode = recUserInfo.getOpenMode(); if (bRefreshOnChange) recUserInfo.setOpenMode(recUserInfo.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current else recUserInfo.setOpenMode(recUserInfo.getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current try { recUserInfo.addNew(); // new user if ((strUserID != null) && (strUserID.length() > 0)) if (!Utility.isNumeric(strUserID)) // Can't have a numeric userid. recUserInfo.getField(UserInfoModel.USER_NAME).setString(strUserID); } catch (DBException ex) { bFound = false; } finally { recUserInfo.setOpenMode(iOpenMode); } } return bFound; }
java
public boolean readUserInfo(boolean bRefreshOnChange, boolean bForceRead) { String strUserID = this.getProperty(DBParams.USER_ID); if (strUserID == null) strUserID = this.getProperty(DBParams.USER_NAME); if (strUserID == null) strUserID = Constants.BLANK; Record recUserInfo = (Record)this.getUserInfo(); if (recUserInfo == null) recUserInfo = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, m_systemRecordOwner); else { try { if (recUserInfo.getEditMode() == DBConstants.EDIT_IN_PROGRESS) if (recUserInfo.isModified()) { int iID = (int)recUserInfo.getCounterField().getValue(); recUserInfo.set(); // Update the current record. if (iID != recUserInfo.getCounterField().getValue()) this.setProperty(DBParams.USER_ID, recUserInfo.getCounterField().toString()); } } catch (DBException ex) { ex.printStackTrace(); } } boolean bFound = ((UserInfoModel)recUserInfo).getUserInfo(strUserID, bForceRead); // This will read using either the userID or the user name if (!bFound) { // Not found, add new int iOpenMode = recUserInfo.getOpenMode(); if (bRefreshOnChange) recUserInfo.setOpenMode(recUserInfo.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current else recUserInfo.setOpenMode(recUserInfo.getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current try { recUserInfo.addNew(); // new user if ((strUserID != null) && (strUserID.length() > 0)) if (!Utility.isNumeric(strUserID)) // Can't have a numeric userid. recUserInfo.getField(UserInfoModel.USER_NAME).setString(strUserID); } catch (DBException ex) { bFound = false; } finally { recUserInfo.setOpenMode(iOpenMode); } } return bFound; }
[ "public", "boolean", "readUserInfo", "(", "boolean", "bRefreshOnChange", ",", "boolean", "bForceRead", ")", "{", "String", "strUserID", "=", "this", ".", "getProperty", "(", "DBParams", ".", "USER_ID", ")", ";", "if", "(", "strUserID", "==", "null", ")", "strUserID", "=", "this", ".", "getProperty", "(", "DBParams", ".", "USER_NAME", ")", ";", "if", "(", "strUserID", "==", "null", ")", "strUserID", "=", "Constants", ".", "BLANK", ";", "Record", "recUserInfo", "=", "(", "Record", ")", "this", ".", "getUserInfo", "(", ")", ";", "if", "(", "recUserInfo", "==", "null", ")", "recUserInfo", "=", "Record", ".", "makeRecordFromClassName", "(", "UserInfoModel", ".", "THICK_CLASS", ",", "m_systemRecordOwner", ")", ";", "else", "{", "try", "{", "if", "(", "recUserInfo", ".", "getEditMode", "(", ")", "==", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", "if", "(", "recUserInfo", ".", "isModified", "(", ")", ")", "{", "int", "iID", "=", "(", "int", ")", "recUserInfo", ".", "getCounterField", "(", ")", ".", "getValue", "(", ")", ";", "recUserInfo", ".", "set", "(", ")", ";", "// Update the current record.", "if", "(", "iID", "!=", "recUserInfo", ".", "getCounterField", "(", ")", ".", "getValue", "(", ")", ")", "this", ".", "setProperty", "(", "DBParams", ".", "USER_ID", ",", "recUserInfo", ".", "getCounterField", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "boolean", "bFound", "=", "(", "(", "UserInfoModel", ")", "recUserInfo", ")", ".", "getUserInfo", "(", "strUserID", ",", "bForceRead", ")", ";", "// This will read using either the userID or the user name", "if", "(", "!", "bFound", ")", "{", "// Not found, add new", "int", "iOpenMode", "=", "recUserInfo", ".", "getOpenMode", "(", ")", ";", "if", "(", "bRefreshOnChange", ")", "recUserInfo", ".", "setOpenMode", "(", "recUserInfo", ".", "getOpenMode", "(", ")", "|", "DBConstants", ".", "OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY", ")", ";", "// Refresh if new, lock if current", "else", "recUserInfo", ".", "setOpenMode", "(", "recUserInfo", ".", "getOpenMode", "(", ")", "&", "~", "DBConstants", ".", "OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY", ")", ";", "// Refresh if new, lock if current", "try", "{", "recUserInfo", ".", "addNew", "(", ")", ";", "// new user", "if", "(", "(", "strUserID", "!=", "null", ")", "&&", "(", "strUserID", ".", "length", "(", ")", ">", "0", ")", ")", "if", "(", "!", "Utility", ".", "isNumeric", "(", "strUserID", ")", ")", "// Can't have a numeric userid.", "recUserInfo", ".", "getField", "(", "UserInfoModel", ".", "USER_NAME", ")", ".", "setString", "(", "strUserID", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "bFound", "=", "false", ";", "}", "finally", "{", "recUserInfo", ".", "setOpenMode", "(", "iOpenMode", ")", ";", "}", "}", "return", "bFound", ";", "}" ]
Read the user info record for the current user. @param bRefreshOnChange If true, don't use the cached value
[ "Read", "the", "user", "info", "record", "for", "the", "current", "user", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L427-L472
154,297
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.removeUserProperties
public void removeUserProperties(UserProperties userProperties) { if (m_htRegistration.get(userProperties.getKey()) != null) m_htRegistration.remove(userProperties.getKey()); }
java
public void removeUserProperties(UserProperties userProperties) { if (m_htRegistration.get(userProperties.getKey()) != null) m_htRegistration.remove(userProperties.getKey()); }
[ "public", "void", "removeUserProperties", "(", "UserProperties", "userProperties", ")", "{", "if", "(", "m_htRegistration", ".", "get", "(", "userProperties", ".", "getKey", "(", ")", ")", "!=", "null", ")", "m_htRegistration", ".", "remove", "(", "userProperties", ".", "getKey", "(", ")", ")", ";", "}" ]
Remove this user registration record. @param userProperties The user properties to remove.
[ "Remove", "this", "user", "registration", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L602-L606
154,298
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.getUserRegistration
public Record getUserRegistration() { Record recUserRegistration = (Record)m_systemRecordOwner.getRecord(UserRegistrationModel.USER_REGISTRATION_FILE); if (recUserRegistration == null) recUserRegistration = Record.makeRecordFromClassName(UserRegistrationModel.THICK_CLASS, m_systemRecordOwner); return recUserRegistration; }
java
public Record getUserRegistration() { Record recUserRegistration = (Record)m_systemRecordOwner.getRecord(UserRegistrationModel.USER_REGISTRATION_FILE); if (recUserRegistration == null) recUserRegistration = Record.makeRecordFromClassName(UserRegistrationModel.THICK_CLASS, m_systemRecordOwner); return recUserRegistration; }
[ "public", "Record", "getUserRegistration", "(", ")", "{", "Record", "recUserRegistration", "=", "(", "Record", ")", "m_systemRecordOwner", ".", "getRecord", "(", "UserRegistrationModel", ".", "USER_REGISTRATION_FILE", ")", ";", "if", "(", "recUserRegistration", "==", "null", ")", "recUserRegistration", "=", "Record", ".", "makeRecordFromClassName", "(", "UserRegistrationModel", ".", "THICK_CLASS", ",", "m_systemRecordOwner", ")", ";", "return", "recUserRegistration", ";", "}" ]
Get the user registration record. And create it if it doesn't exist yet. @return The user registration record.
[ "Get", "the", "user", "registration", "record", ".", "And", "create", "it", "if", "it", "doesn", "t", "exist", "yet", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L612-L618
154,299
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.getUserInfo
public UserInfoModel getUserInfo() { UserInfoModel recUserInfo = null; if (m_systemRecordOwner != null) recUserInfo = (UserInfoModel)m_systemRecordOwner.getRecord(UserInfoModel.USER_INFO_FILE); return recUserInfo; }
java
public UserInfoModel getUserInfo() { UserInfoModel recUserInfo = null; if (m_systemRecordOwner != null) recUserInfo = (UserInfoModel)m_systemRecordOwner.getRecord(UserInfoModel.USER_INFO_FILE); return recUserInfo; }
[ "public", "UserInfoModel", "getUserInfo", "(", ")", "{", "UserInfoModel", "recUserInfo", "=", "null", ";", "if", "(", "m_systemRecordOwner", "!=", "null", ")", "recUserInfo", "=", "(", "UserInfoModel", ")", "m_systemRecordOwner", ".", "getRecord", "(", "UserInfoModel", ".", "USER_INFO_FILE", ")", ";", "return", "recUserInfo", ";", "}" ]
Get the user information record. @return The userinfo record.
[ "Get", "the", "user", "information", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L623-L629