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
partition
stringclasses
1 value
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.registerAllowedParentClass
protected static synchronized void registerAllowedParentClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> parentClass) { allowedParentClasses.addCardinality(clazz, parentClass, 1); }
java
protected static synchronized void registerAllowedParentClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> parentClass) { allowedParentClasses.addCardinality(clazz, parentClass, 1); }
[ "protected", "static", "synchronized", "void", "registerAllowedParentClass", "(", "Class", "<", "?", "extends", "ElementBase", ">", "clazz", ",", "Class", "<", "?", "extends", "ElementBase", ">", "parentClass", ")", "{", "allowedParentClasses", ".", "addCardinality"...
A ElementBase subclass should call this in its static initializer block to register any subclasses that may act as a parent. @param clazz Class whose valid parent classes are to be registered. @param parentClass Class that may act as a parent to clazz.
[ "A", "ElementBase", "subclass", "should", "call", "this", "in", "its", "static", "initializer", "block", "to", "register", "any", "subclasses", "that", "may", "act", "as", "a", "parent", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L92-L95
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.registerAllowedChildClass
protected static synchronized void registerAllowedChildClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> childClass, int maxOccurrences) { allowedChildClasses.addCardinality(clazz, childClass, maxOccurrences); }
java
protected static synchronized void registerAllowedChildClass(Class<? extends ElementBase> clazz, Class<? extends ElementBase> childClass, int maxOccurrences) { allowedChildClasses.addCardinality(clazz, childClass, maxOccurrences); }
[ "protected", "static", "synchronized", "void", "registerAllowedChildClass", "(", "Class", "<", "?", "extends", "ElementBase", ">", "clazz", ",", "Class", "<", "?", "extends", "ElementBase", ">", "childClass", ",", "int", "maxOccurrences", ")", "{", "allowedChildCl...
A ElementBase subclass should call this in its static initializer block to register any subclasses that may be a child. @param clazz Class whose valid child classes are to be registered. @param childClass Class that may be a child of clazz. @param maxOccurrences Maximum occurrences for the child class.
[ "A", "ElementBase", "subclass", "should", "call", "this", "in", "its", "static", "initializer", "block", "to", "register", "any", "subclasses", "that", "may", "be", "a", "child", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L105-L109
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptChild
public static boolean canAcceptChild(Class<? extends ElementBase> parentClass, Class<? extends ElementBase> childClass) { return allowedChildClasses.isRelated(parentClass, childClass); }
java
public static boolean canAcceptChild(Class<? extends ElementBase> parentClass, Class<? extends ElementBase> childClass) { return allowedChildClasses.isRelated(parentClass, childClass); }
[ "public", "static", "boolean", "canAcceptChild", "(", "Class", "<", "?", "extends", "ElementBase", ">", "parentClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "childClass", ")", "{", "return", "allowedChildClasses", ".", "isRelated", "(", "parentC...
Returns true if childClass can be a child of the parentClass. @param parentClass Parent class @param childClass Child class @return True if childClass can be a child of the parentClass.
[ "Returns", "true", "if", "childClass", "can", "be", "a", "child", "of", "the", "parentClass", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L118-L120
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptParent
public static boolean canAcceptParent(Class<? extends ElementBase> childClass, Class<? extends ElementBase> parentClass) { return allowedParentClasses.isRelated(childClass, parentClass); }
java
public static boolean canAcceptParent(Class<? extends ElementBase> childClass, Class<? extends ElementBase> parentClass) { return allowedParentClasses.isRelated(childClass, parentClass); }
[ "public", "static", "boolean", "canAcceptParent", "(", "Class", "<", "?", "extends", "ElementBase", ">", "childClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "parentClass", ")", "{", "return", "allowedParentClasses", ".", "isRelated", "(", "child...
Returns true if parentClass can be a parent of childClass. @param childClass The child class. @param parentClass The parent class. @return True if parentClass can be a parent of childClass.
[ "Returns", "true", "if", "parentClass", "can", "be", "a", "parent", "of", "childClass", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L129-L132
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.addChild
protected void addChild(ElementBase child, boolean doEvent) { if (!child.canAcceptParent(this)) { CWFException.raise(child.rejectReason); } if (!canAcceptChild(child)) { CWFException.raise(rejectReason); } if (doEvent) { beforeAddChild(child); } if (child.getParent() != null) { child.getParent().removeChild(child, false); } children.add(child); child.updateParent(this); if (doEvent) { afterAddChild(child); } }
java
protected void addChild(ElementBase child, boolean doEvent) { if (!child.canAcceptParent(this)) { CWFException.raise(child.rejectReason); } if (!canAcceptChild(child)) { CWFException.raise(rejectReason); } if (doEvent) { beforeAddChild(child); } if (child.getParent() != null) { child.getParent().removeChild(child, false); } children.add(child); child.updateParent(this); if (doEvent) { afterAddChild(child); } }
[ "protected", "void", "addChild", "(", "ElementBase", "child", ",", "boolean", "doEvent", ")", "{", "if", "(", "!", "child", ".", "canAcceptParent", "(", "this", ")", ")", "{", "CWFException", ".", "raise", "(", "child", ".", "rejectReason", ")", ";", "}"...
Adds the specified child element. The validity of the operation is first tested and an exception thrown if the element is not a valid child for this parent. @param child Element to add as a child. @param doEvent Fires the add child events if true.
[ "Adds", "the", "specified", "child", "element", ".", "The", "validity", "of", "the", "operation", "is", "first", "tested", "and", "an", "exception", "thrown", "if", "the", "element", "is", "not", "a", "valid", "child", "for", "this", "parent", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L155-L178
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.removeChild
public void removeChild(ElementBase child, boolean destroy) { if (!children.contains(child)) { return; } boolean isLocked = child.isLocked() || child.getDefinition().isInternal(); if (destroy) { child.removeChildren(); if (!isLocked) { child.destroy(); } } if (!isLocked) { beforeRemoveChild(child); children.remove(child); child.updateParent(null); afterRemoveChild(child); } }
java
public void removeChild(ElementBase child, boolean destroy) { if (!children.contains(child)) { return; } boolean isLocked = child.isLocked() || child.getDefinition().isInternal(); if (destroy) { child.removeChildren(); if (!isLocked) { child.destroy(); } } if (!isLocked) { beforeRemoveChild(child); children.remove(child); child.updateParent(null); afterRemoveChild(child); } }
[ "public", "void", "removeChild", "(", "ElementBase", "child", ",", "boolean", "destroy", ")", "{", "if", "(", "!", "children", ".", "contains", "(", "child", ")", ")", "{", "return", ";", "}", "boolean", "isLocked", "=", "child", ".", "isLocked", "(", ...
Removes the specified element as a child of this parent. @param child Child element to remove. @param destroy If true the child is explicitly destroyed.
[ "Removes", "the", "specified", "element", "as", "a", "child", "of", "this", "parent", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L202-L223
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.updateParent
private void updateParent(ElementBase newParent) { ElementBase oldParent = this.parent; if (oldParent != newParent) { beforeParentChanged(newParent); this.parent = newParent; if (oldParent != null) { oldParent.updateState(); } if (newParent != null) { afterParentChanged(oldParent); newParent.updateState(); } } }
java
private void updateParent(ElementBase newParent) { ElementBase oldParent = this.parent; if (oldParent != newParent) { beforeParentChanged(newParent); this.parent = newParent; if (oldParent != null) { oldParent.updateState(); } if (newParent != null) { afterParentChanged(oldParent); newParent.updateState(); } } }
[ "private", "void", "updateParent", "(", "ElementBase", "newParent", ")", "{", "ElementBase", "oldParent", "=", "this", ".", "parent", ";", "if", "(", "oldParent", "!=", "newParent", ")", "{", "beforeParentChanged", "(", "newParent", ")", ";", "this", ".", "p...
Changes the assigned parent, firing parent changed events if appropriate. @param newParent The new parent.
[ "Changes", "the", "assigned", "parent", "firing", "parent", "changed", "events", "if", "appropriate", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L246-L262
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.removeChildren
public void removeChildren() { for (int i = children.size() - 1; i >= 0; i--) { removeChild(children.get(i), true); } }
java
public void removeChildren() { for (int i = children.size() - 1; i >= 0; i--) { removeChild(children.get(i), true); } }
[ "public", "void", "removeChildren", "(", ")", "{", "for", "(", "int", "i", "=", "children", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "removeChild", "(", "children", ".", "get", "(", "i", ")", ",", "true", ...
Remove and destroy all children associated with this element.
[ "Remove", "and", "destroy", "all", "children", "associated", "with", "this", "element", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L294-L298
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.setDefinition
public void setDefinition(PluginDefinition definition) { if (this.definition != null) { if (this.definition == definition) { return; } CWFException.raise("Cannot modify plugin definition."); } this.definition = definition; // Assign any default property values. if (definition != null) { for (PropertyInfo propInfo : definition.getProperties()) { String dflt = propInfo.getDefault(); if (dflt != null) { try { propInfo.setPropertyValue(this, dflt); } catch (Exception e) { log.error("Error setting default value for property " + propInfo.getName(), e); } } } } }
java
public void setDefinition(PluginDefinition definition) { if (this.definition != null) { if (this.definition == definition) { return; } CWFException.raise("Cannot modify plugin definition."); } this.definition = definition; // Assign any default property values. if (definition != null) { for (PropertyInfo propInfo : definition.getProperties()) { String dflt = propInfo.getDefault(); if (dflt != null) { try { propInfo.setPropertyValue(this, dflt); } catch (Exception e) { log.error("Error setting default value for property " + propInfo.getName(), e); } } } } }
[ "public", "void", "setDefinition", "(", "PluginDefinition", "definition", ")", "{", "if", "(", "this", ".", "definition", "!=", "null", ")", "{", "if", "(", "this", ".", "definition", "==", "definition", ")", "{", "return", ";", "}", "CWFException", ".", ...
Sets the plugin definition for this element. @param definition The plugin definition.
[ "Sets", "the", "plugin", "definition", "for", "this", "element", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L325-L350
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.setDesignMode
public void setDesignMode(boolean designMode) { this.designMode = designMode; for (ElementBase child : children) { child.setDesignMode(designMode); } updateState(); }
java
public void setDesignMode(boolean designMode) { this.designMode = designMode; for (ElementBase child : children) { child.setDesignMode(designMode); } updateState(); }
[ "public", "void", "setDesignMode", "(", "boolean", "designMode", ")", "{", "this", ".", "designMode", "=", "designMode", ";", "for", "(", "ElementBase", "child", ":", "children", ")", "{", "child", ".", "setDesignMode", "(", "designMode", ")", ";", "}", "u...
Sets design mode status for this component and all its children. @param designMode The design mode flag.
[ "Sets", "design", "mode", "status", "for", "this", "component", "and", "all", "its", "children", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L376-L384
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.editProperties
public void editProperties() { try { PropertyGrid.create(this, null); } catch (Exception e) { DialogUtil.showError("Displaying property grid: \r\n" + e.toString()); } }
java
public void editProperties() { try { PropertyGrid.create(this, null); } catch (Exception e) { DialogUtil.showError("Displaying property grid: \r\n" + e.toString()); } }
[ "public", "void", "editProperties", "(", ")", "{", "try", "{", "PropertyGrid", ".", "create", "(", "this", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "DialogUtil", ".", "showError", "(", "\"Displaying property grid: \\r\\n\"", "+",...
Invokes the property grid with this element as its target.
[ "Invokes", "the", "property", "grid", "with", "this", "element", "as", "its", "target", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L396-L402
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getChild
@SuppressWarnings("unchecked") public <T extends ElementBase> T getChild(Class<T> clazz, ElementBase last) { int i = last == null ? -1 : children.indexOf(last); for (i++; i < children.size(); i++) { if (clazz.isInstance(children.get(i))) { return (T) children.get(i); } } return null; }
java
@SuppressWarnings("unchecked") public <T extends ElementBase> T getChild(Class<T> clazz, ElementBase last) { int i = last == null ? -1 : children.indexOf(last); for (i++; i < children.size(); i++) { if (clazz.isInstance(children.get(i))) { return (T) children.get(i); } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "ElementBase", ">", "T", "getChild", "(", "Class", "<", "T", ">", "clazz", ",", "ElementBase", "last", ")", "{", "int", "i", "=", "last", "==", "null", "?", "-", "1", ...
Locates and returns a child that is an instance of the specified class. If none is found, returns null. @param <T> The type of child being sought. @param clazz Class of the child being sought. @param last If specified, the search begins after this child. If null, the search begins with the first child. @return The requested child or null if none found.
[ "Locates", "and", "returns", "a", "child", "that", "is", "an", "instance", "of", "the", "specified", "class", ".", "If", "none", "is", "found", "returns", "null", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L437-L448
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getChildren
public <T extends ElementBase> Iterable<T> getChildren(Class<T> clazz) { return MiscUtil.iterableForType(children, clazz); }
java
public <T extends ElementBase> Iterable<T> getChildren(Class<T> clazz) { return MiscUtil.iterableForType(children, clazz); }
[ "public", "<", "T", "extends", "ElementBase", ">", "Iterable", "<", "T", ">", "getChildren", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "MiscUtil", ".", "iterableForType", "(", "children", ",", "clazz", ")", ";", "}" ]
Returns an iterable of this component's children restricted to the specified type. @param <T> Type of children returned by iterable. @param clazz Restrict to children of this type. @return Iterable of this component's children.
[ "Returns", "an", "iterable", "of", "this", "component", "s", "children", "restricted", "to", "the", "specified", "type", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L466-L468
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getChildCount
public int getChildCount(Class<? extends ElementBase> clazz) { if (clazz == ElementBase.class) { return getChildCount(); } int count = 0; for (ElementBase child : children) { if (clazz.isInstance(child)) { count++; } } return count; }
java
public int getChildCount(Class<? extends ElementBase> clazz) { if (clazz == ElementBase.class) { return getChildCount(); } int count = 0; for (ElementBase child : children) { if (clazz.isInstance(child)) { count++; } } return count; }
[ "public", "int", "getChildCount", "(", "Class", "<", "?", "extends", "ElementBase", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "ElementBase", ".", "class", ")", "{", "return", "getChildCount", "(", ")", ";", "}", "int", "count", "=", "0", ";", ...
Returns the number of children. @param clazz Restrict to children of this type. @return Number of children.
[ "Returns", "the", "number", "of", "children", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L495-L509
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.findChildElement
@SuppressWarnings("unchecked") public <T extends ElementBase> T findChildElement(Class<T> clazz) { for (ElementBase child : getChildren()) { if (clazz.isInstance(child)) { return (T) child; } } for (ElementBase child : getChildren()) { T child2 = child.findChildElement(clazz); if (child2 != null) { return child2; } } return null; }
java
@SuppressWarnings("unchecked") public <T extends ElementBase> T findChildElement(Class<T> clazz) { for (ElementBase child : getChildren()) { if (clazz.isInstance(child)) { return (T) child; } } for (ElementBase child : getChildren()) { T child2 = child.findChildElement(clazz); if (child2 != null) { return child2; } } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "ElementBase", ">", "T", "findChildElement", "(", "Class", "<", "T", ">", "clazz", ")", "{", "for", "(", "ElementBase", "child", ":", "getChildren", "(", ")", ")", "{", "i...
Recurses the component subtree for a child belonging to the specified class. @param <T> The type of child being sought. @param clazz Class of child being sought. @return A child of the specified class, or null if not found.
[ "Recurses", "the", "component", "subtree", "for", "a", "child", "belonging", "to", "the", "specified", "class", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L557-L574
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.hasAncestor
public boolean hasAncestor(ElementBase element) { ElementBase child = this; while (child != null) { if (element.hasChild(child)) { return true; } child = child.getParent(); } return false; }
java
public boolean hasAncestor(ElementBase element) { ElementBase child = this; while (child != null) { if (element.hasChild(child)) { return true; } child = child.getParent(); } return false; }
[ "public", "boolean", "hasAncestor", "(", "ElementBase", "element", ")", "{", "ElementBase", "child", "=", "this", ";", "while", "(", "child", "!=", "null", ")", "{", "if", "(", "element", ".", "hasChild", "(", "child", ")", ")", "{", "return", "true", ...
Returns true if specified element is an ancestor of this element. @param element A UI element. @return True if the specified element is an ancestor of this element.
[ "Returns", "true", "if", "specified", "element", "is", "an", "ancestor", "of", "this", "element", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L582-L593
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.moveChild
public void moveChild(int from, int to) { if (from != to) { ElementBase child = children.get(from); ElementBase ref = children.get(to); children.remove(from); to = children.indexOf(ref); children.add(to, child); afterMoveChild(child, ref); } }
java
public void moveChild(int from, int to) { if (from != to) { ElementBase child = children.get(from); ElementBase ref = children.get(to); children.remove(from); to = children.indexOf(ref); children.add(to, child); afterMoveChild(child, ref); } }
[ "public", "void", "moveChild", "(", "int", "from", ",", "int", "to", ")", "{", "if", "(", "from", "!=", "to", ")", "{", "ElementBase", "child", "=", "children", ".", "get", "(", "from", ")", ";", "ElementBase", "ref", "=", "children", ".", "get", "...
Moves a child from one position to another under the same parent. @param from Current position of child. @param to New position of child.
[ "Moves", "a", "child", "from", "one", "position", "to", "another", "under", "the", "same", "parent", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L611-L620
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.setIndex
public void setIndex(int index) { ElementBase parent = getParent(); if (parent == null) { CWFException.raise("Element has no parent."); } int currentIndex = parent.children.indexOf(this); if (currentIndex < 0 || currentIndex == index) { return; } parent.moveChild(currentIndex, index); }
java
public void setIndex(int index) { ElementBase parent = getParent(); if (parent == null) { CWFException.raise("Element has no parent."); } int currentIndex = parent.children.indexOf(this); if (currentIndex < 0 || currentIndex == index) { return; } parent.moveChild(currentIndex, index); }
[ "public", "void", "setIndex", "(", "int", "index", ")", "{", "ElementBase", "parent", "=", "getParent", "(", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "CWFException", ".", "raise", "(", "\"Element has no parent.\"", ")", ";", "}", "int", "cu...
Sets this element's index to the specified value. This effectively changes the position of the element relative to its siblings. @param index The index.
[ "Sets", "this", "element", "s", "index", "to", "the", "specified", "value", ".", "This", "effectively", "changes", "the", "position", "of", "the", "element", "relative", "to", "its", "siblings", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L637-L651
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.moveChild
protected void moveChild(BaseUIComponent child, BaseUIComponent before) { child.getParent().addChild(child, before); }
java
protected void moveChild(BaseUIComponent child, BaseUIComponent before) { child.getParent().addChild(child, before); }
[ "protected", "void", "moveChild", "(", "BaseUIComponent", "child", ",", "BaseUIComponent", "before", ")", "{", "child", ".", "getParent", "(", ")", ".", "addChild", "(", "child", ",", "before", ")", ";", "}" ]
Moves a child to before another component. @param child Child to move @param before Move child to this component.
[ "Moves", "a", "child", "to", "before", "another", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L763-L765
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptChild
public boolean canAcceptChild() { if (maxChildren == 0) { rejectReason = getDisplayName() + " does not accept any children."; } else if (getChildCount() >= maxChildren) { rejectReason = "Maximum child count exceeded for " + getDisplayName() + "."; } else { rejectReason = null; } return rejectReason == null; }
java
public boolean canAcceptChild() { if (maxChildren == 0) { rejectReason = getDisplayName() + " does not accept any children."; } else if (getChildCount() >= maxChildren) { rejectReason = "Maximum child count exceeded for " + getDisplayName() + "."; } else { rejectReason = null; } return rejectReason == null; }
[ "public", "boolean", "canAcceptChild", "(", ")", "{", "if", "(", "maxChildren", "==", "0", ")", "{", "rejectReason", "=", "getDisplayName", "(", ")", "+", "\" does not accept any children.\"", ";", "}", "else", "if", "(", "getChildCount", "(", ")", ">=", "ma...
Returns true if this element may accept a child. Updates the reject reason with the result. @return True if this element may accept a child. Updates the reject reason with the result.
[ "Returns", "true", "if", "this", "element", "may", "accept", "a", "child", ".", "Updates", "the", "reject", "reason", "with", "the", "result", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L796-L806
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptChild
public boolean canAcceptChild(Class<? extends ElementBase> childClass) { if (!canAcceptChild()) { return false; } Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass); int max = cardinality.getMaxOccurrences(); if (max == 0) { rejectReason = getDisplayName() + " does not accept " + childClass.getSimpleName() + " as a child."; } else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) { rejectReason = getDisplayName() + " cannot accept more than " + max + " of " + cardinality.getTargetClass().getSimpleName() + "."; } return rejectReason == null; }
java
public boolean canAcceptChild(Class<? extends ElementBase> childClass) { if (!canAcceptChild()) { return false; } Cardinality cardinality = allowedChildClasses.getCardinality(getClass(), childClass); int max = cardinality.getMaxOccurrences(); if (max == 0) { rejectReason = getDisplayName() + " does not accept " + childClass.getSimpleName() + " as a child."; } else if (max != Integer.MAX_VALUE && getChildCount(cardinality.getTargetClass()) >= max) { rejectReason = getDisplayName() + " cannot accept more than " + max + " of " + cardinality.getTargetClass().getSimpleName() + "."; } return rejectReason == null; }
[ "public", "boolean", "canAcceptChild", "(", "Class", "<", "?", "extends", "ElementBase", ">", "childClass", ")", "{", "if", "(", "!", "canAcceptChild", "(", ")", ")", "{", "return", "false", ";", "}", "Cardinality", "cardinality", "=", "allowedChildClasses", ...
Returns true if this element may accept a child of the specified class. Updates the reject reason with the result. @param childClass Child class to test. @return True if this element may accept a child of the specified class.
[ "Returns", "true", "if", "this", "element", "may", "accept", "a", "child", "of", "the", "specified", "class", ".", "Updates", "the", "reject", "reason", "with", "the", "result", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L815-L831
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptParent
public boolean canAcceptParent(Class<? extends ElementBase> clazz) { if (!canAcceptParent(getClass(), clazz)) { rejectReason = getDisplayName() + " does not accept " + clazz.getSimpleName() + " as a parent."; } else { rejectReason = null; } return rejectReason == null; }
java
public boolean canAcceptParent(Class<? extends ElementBase> clazz) { if (!canAcceptParent(getClass(), clazz)) { rejectReason = getDisplayName() + " does not accept " + clazz.getSimpleName() + " as a parent."; } else { rejectReason = null; } return rejectReason == null; }
[ "public", "boolean", "canAcceptParent", "(", "Class", "<", "?", "extends", "ElementBase", ">", "clazz", ")", "{", "if", "(", "!", "canAcceptParent", "(", "getClass", "(", ")", ",", "clazz", ")", ")", "{", "rejectReason", "=", "getDisplayName", "(", ")", ...
Returns true if this element may accept a parent of the specified class. Updates the reject reason with the result. @param clazz Parent class to test. @return True if this element may accept a parent of the specified class.
[ "Returns", "true", "if", "this", "element", "may", "accept", "a", "parent", "of", "the", "specified", "class", ".", "Updates", "the", "reject", "reason", "with", "the", "result", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L862-L870
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.canAcceptParent
public boolean canAcceptParent(ElementBase parent) { if (!canAcceptParent()) { return false; } if (!canAcceptParent(getClass(), parent.getClass())) { rejectReason = getDisplayName() + " does not accept " + parent.getDisplayName() + " as a parent."; } else { rejectReason = null; } return rejectReason == null; }
java
public boolean canAcceptParent(ElementBase parent) { if (!canAcceptParent()) { return false; } if (!canAcceptParent(getClass(), parent.getClass())) { rejectReason = getDisplayName() + " does not accept " + parent.getDisplayName() + " as a parent."; } else { rejectReason = null; } return rejectReason == null; }
[ "public", "boolean", "canAcceptParent", "(", "ElementBase", "parent", ")", "{", "if", "(", "!", "canAcceptParent", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "canAcceptParent", "(", "getClass", "(", ")", ",", "parent", ".", "getClas...
Returns true if this element may accept the specified element as a parent. Updates the reject reason with the result. @param parent Parent instance to test. @return True if this element may accept the specified element as a parent.
[ "Returns", "true", "if", "this", "element", "may", "accept", "the", "specified", "element", "as", "a", "parent", ".", "Updates", "the", "reject", "reason", "with", "the", "result", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L879-L891
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getRoot
public ElementBase getRoot() { ElementBase root = this; while (root.getParent() != null) { root = root.getParent(); } return root; }
java
public ElementBase getRoot() { ElementBase root = this; while (root.getParent() != null) { root = root.getParent(); } return root; }
[ "public", "ElementBase", "getRoot", "(", ")", "{", "ElementBase", "root", "=", "this", ";", "while", "(", "root", ".", "getParent", "(", ")", "!=", "null", ")", "{", "root", "=", "root", ".", "getParent", "(", ")", ";", "}", "return", "root", ";", ...
Returns the UI element at the root of the component tree. @return Root UI element.
[ "Returns", "the", "UI", "element", "at", "the", "root", "of", "the", "component", "tree", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L916-L924
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.getAncestor
@SuppressWarnings("unchecked") public <T extends ElementBase> T getAncestor(Class<T> clazz) { ElementBase parent = getParent(); while (parent != null && !clazz.isInstance(parent)) { parent = parent.getParent(); } return (T) parent; }
java
@SuppressWarnings("unchecked") public <T extends ElementBase> T getAncestor(Class<T> clazz) { ElementBase parent = getParent(); while (parent != null && !clazz.isInstance(parent)) { parent = parent.getParent(); } return (T) parent; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "ElementBase", ">", "T", "getAncestor", "(", "Class", "<", "T", ">", "clazz", ")", "{", "ElementBase", "parent", "=", "getParent", "(", ")", ";", "while", "(", "parent", "...
Returns the first ancestor corresponding to the specified class. @param <T> The type of ancestor sought. @param clazz Class of ancestor sought. @return An ancestor of the specified class or null if not found.
[ "Returns", "the", "first", "ancestor", "corresponding", "to", "the", "specified", "class", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L933-L942
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.processResources
private void processResources(boolean register) { CareWebShell shell = CareWebUtil.getShell(); for (IPluginResource resource : getDefinition().getResources()) { resource.register(shell, this, register); } }
java
private void processResources(boolean register) { CareWebShell shell = CareWebUtil.getShell(); for (IPluginResource resource : getDefinition().getResources()) { resource.register(shell, this, register); } }
[ "private", "void", "processResources", "(", "boolean", "register", ")", "{", "CareWebShell", "shell", "=", "CareWebUtil", ".", "getShell", "(", ")", ";", "for", "(", "IPluginResource", "resource", ":", "getDefinition", "(", ")", ".", "getResources", "(", ")", ...
Process all associated resources. @param register If true, resources will be registered; if false, unregistered.
[ "Process", "all", "associated", "resources", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L970-L976
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.notifyParent
public void notifyParent(String eventName, Object eventData, boolean recurse) { ElementBase ele = parent; while (ele != null) { recurse &= ele.parentListeners.notify(this, eventName, eventData); ele = recurse ? ele.parent : null; } }
java
public void notifyParent(String eventName, Object eventData, boolean recurse) { ElementBase ele = parent; while (ele != null) { recurse &= ele.parentListeners.notify(this, eventName, eventData); ele = recurse ? ele.parent : null; } }
[ "public", "void", "notifyParent", "(", "String", "eventName", ",", "Object", "eventData", ",", "boolean", "recurse", ")", "{", "ElementBase", "ele", "=", "parent", ";", "while", "(", "ele", "!=", "null", ")", "{", "recurse", "&=", "ele", ".", "parentListen...
Allows a child element to notify its parent of an event of interest. @param eventName Name of the event. @param eventData Data associated with the event. @param recurse If true, recurse up the parent chain.
[ "Allows", "a", "child", "element", "to", "notify", "its", "parent", "of", "an", "event", "of", "interest", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L985-L992
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.notifyChildren
public void notifyChildren(String eventName, Object eventData, boolean recurse) { notifyChildren(this, eventName, eventData, recurse); }
java
public void notifyChildren(String eventName, Object eventData, boolean recurse) { notifyChildren(this, eventName, eventData, recurse); }
[ "public", "void", "notifyChildren", "(", "String", "eventName", ",", "Object", "eventData", ",", "boolean", "recurse", ")", "{", "notifyChildren", "(", "this", ",", "eventName", ",", "eventData", ",", "recurse", ")", ";", "}" ]
Allows a parent element to notify its children of an event of interest. @param eventName Name of the event. @param eventData Data associated with the event. @param recurse If true, recurse over all child levels.
[ "Allows", "a", "parent", "element", "to", "notify", "its", "children", "of", "an", "event", "of", "interest", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L1012-L1014
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java
InfoPanelService.searchChildren
private static IInfoPanel searchChildren(ElementBase parent, ElementBase exclude, boolean activeOnly) { IInfoPanel infoPanel = null; if (parent != null) { for (ElementBase child : parent.getChildren()) { if ((child != exclude) && ((infoPanel = getInfoPanel(child, activeOnly)) != null)) { break; } } if (infoPanel == null) { for (ElementBase child : parent.getChildren()) { if ((child != exclude) && ((infoPanel = searchChildren(child, null, activeOnly)) != null)) { break; } } } } return infoPanel; }
java
private static IInfoPanel searchChildren(ElementBase parent, ElementBase exclude, boolean activeOnly) { IInfoPanel infoPanel = null; if (parent != null) { for (ElementBase child : parent.getChildren()) { if ((child != exclude) && ((infoPanel = getInfoPanel(child, activeOnly)) != null)) { break; } } if (infoPanel == null) { for (ElementBase child : parent.getChildren()) { if ((child != exclude) && ((infoPanel = searchChildren(child, null, activeOnly)) != null)) { break; } } } } return infoPanel; }
[ "private", "static", "IInfoPanel", "searchChildren", "(", "ElementBase", "parent", ",", "ElementBase", "exclude", ",", "boolean", "activeOnly", ")", "{", "IInfoPanel", "infoPanel", "=", "null", ";", "if", "(", "parent", "!=", "null", ")", "{", "for", "(", "E...
Search children of the specified parent for an occurrence of an active info panel. This is a recursive, breadth-first search of the component tree. @param parent Parent whose children are to be searched. @param exclude An optional child to be excluded from the search. @param activeOnly If true, only active info panels are considered. @return The requested info panel, or null if none found.
[ "Search", "children", "of", "the", "specified", "parent", "for", "an", "occurrence", "of", "an", "active", "info", "panel", ".", "This", "is", "a", "recursive", "breadth", "-", "first", "search", "of", "the", "component", "tree", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L109-L129
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java
InfoPanelService.getInfoPanel
private static IInfoPanel getInfoPanel(ElementBase element, boolean activeOnly) { if (element instanceof ElementPlugin) { ElementPlugin plugin = (ElementPlugin) element; if ((!activeOnly || plugin.isActivated()) && (plugin.getDefinition().getId().equals("infoPanelPlugin"))) { plugin.load(); BaseComponent top = plugin.getOuterComponent().findByName("infoPanelRoot"); return (IInfoPanel) FrameworkController.getController(top); } } return null; }
java
private static IInfoPanel getInfoPanel(ElementBase element, boolean activeOnly) { if (element instanceof ElementPlugin) { ElementPlugin plugin = (ElementPlugin) element; if ((!activeOnly || plugin.isActivated()) && (plugin.getDefinition().getId().equals("infoPanelPlugin"))) { plugin.load(); BaseComponent top = plugin.getOuterComponent().findByName("infoPanelRoot"); return (IInfoPanel) FrameworkController.getController(top); } } return null; }
[ "private", "static", "IInfoPanel", "getInfoPanel", "(", "ElementBase", "element", ",", "boolean", "activeOnly", ")", "{", "if", "(", "element", "instanceof", "ElementPlugin", ")", "{", "ElementPlugin", "plugin", "=", "(", "ElementPlugin", ")", "element", ";", "i...
Returns the info panel associated with the UI element, if there is one. @param element The element to examine. @param activeOnly If true, only active info panels are considered. @return The associated active info panel, or null if there is none.
[ "Returns", "the", "info", "panel", "associated", "with", "the", "UI", "element", "if", "there", "is", "one", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L138-L150
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java
InfoPanelService.associateEvent
public static void associateEvent(BaseComponent component, String eventName, Action action) { getActionListeners(component, true).add(new ActionListener(eventName, action)); }
java
public static void associateEvent(BaseComponent component, String eventName, Action action) { getActionListeners(component, true).add(new ActionListener(eventName, action)); }
[ "public", "static", "void", "associateEvent", "(", "BaseComponent", "component", ",", "String", "eventName", ",", "Action", "action", ")", "{", "getActionListeners", "(", "component", ",", "true", ")", ".", "add", "(", "new", "ActionListener", "(", "eventName", ...
Associate a generic event with an action on this component's container. @param component Component whose container is the target of an action. @param eventName The name of the generic event that will invoke the action. @param action The action to be performed.
[ "Associate", "a", "generic", "event", "with", "an", "action", "on", "this", "component", "s", "container", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L159-L161
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java
InfoPanelService.getActionListeners
private static List<ActionListener> getActionListeners(BaseComponent component, boolean forceCreate) { @SuppressWarnings("unchecked") List<ActionListener> ActionListeners = (List<ActionListener>) component.getAttribute(EVENT_LISTENER_ATTR); if (ActionListeners == null && forceCreate) { ActionListeners = new ArrayList<>(); component.setAttribute(EVENT_LISTENER_ATTR, ActionListeners); } return ActionListeners; }
java
private static List<ActionListener> getActionListeners(BaseComponent component, boolean forceCreate) { @SuppressWarnings("unchecked") List<ActionListener> ActionListeners = (List<ActionListener>) component.getAttribute(EVENT_LISTENER_ATTR); if (ActionListeners == null && forceCreate) { ActionListeners = new ArrayList<>(); component.setAttribute(EVENT_LISTENER_ATTR, ActionListeners); } return ActionListeners; }
[ "private", "static", "List", "<", "ActionListener", ">", "getActionListeners", "(", "BaseComponent", "component", ",", "boolean", "forceCreate", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "List", "<", "ActionListener", ">", "ActionListeners", "=",...
Returns a list of events associated with a component. @param component Component of interest. @param forceCreate If true and no current list exists, one will be created. @return The list of associated events (may be null).
[ "Returns", "a", "list", "of", "events", "associated", "with", "a", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L180-L190
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/validate/S2SValidatorServiceImpl.java
S2SValidatorServiceImpl.validate
@Override public boolean validate(XmlObject formObject, List<AuditError> errors, String formName) { final List<String> formErrors = new ArrayList<>(); final boolean result = validateXml(formObject, formErrors); errors.addAll(formErrors.stream() .map(validationError -> s2SErrorHandlerService.getError(GRANTS_GOV_PREFIX + validationError, formName)) .collect(Collectors.toList())); return result; }
java
@Override public boolean validate(XmlObject formObject, List<AuditError> errors, String formName) { final List<String> formErrors = new ArrayList<>(); final boolean result = validateXml(formObject, formErrors); errors.addAll(formErrors.stream() .map(validationError -> s2SErrorHandlerService.getError(GRANTS_GOV_PREFIX + validationError, formName)) .collect(Collectors.toList())); return result; }
[ "@", "Override", "public", "boolean", "validate", "(", "XmlObject", "formObject", ",", "List", "<", "AuditError", ">", "errors", ",", "String", "formName", ")", "{", "final", "List", "<", "String", ">", "formErrors", "=", "new", "ArrayList", "<>", "(", ")"...
This method receives an XMLObject and validates it against its schema and returns the validation result. It also receives a list in which upon validation failure, populates it with XPaths of the error nodes. @param formObject XML document as {@link}XMLObject @param errors List list of XPaths of the error nodes. @return validation result true if valid false otherwise.
[ "This", "method", "receives", "an", "XMLObject", "and", "validates", "it", "against", "its", "schema", "and", "returns", "the", "validation", "result", ".", "It", "also", "receives", "a", "list", "in", "which", "upon", "validation", "failure", "populates", "it...
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/validate/S2SValidatorServiceImpl.java#L61-L72
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java
JdbcQueue.resetRetryCounter
public Map<String, Long> resetRetryCounter() { Map<String, Long> result = retryCounter.asMap(); retryCounter.clear(); return result; }
java
public Map<String, Long> resetRetryCounter() { Map<String, Long> result = retryCounter.asMap(); retryCounter.clear(); return result; }
[ "public", "Map", "<", "String", ",", "Long", ">", "resetRetryCounter", "(", ")", "{", "Map", "<", "String", ",", "Long", ">", "result", "=", "retryCounter", ".", "asMap", "(", ")", ";", "retryCounter", ".", "clear", "(", ")", ";", "return", "result", ...
Reset retry counter. @return old retry counter. @since 0.7.1.1
[ "Reset", "retry", "counter", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java#L69-L73
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java
JdbcQueue._queueWithRetries
protected boolean _queueWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { Date now = new Date(); msg.setNumRequeues(0).setQueueTimestamp(now).setTimestamp(now); return putToQueueStorage(conn, msg); } catch (DuplicatedValueException dve) { LOGGER.warn(dve.getMessage(), dve); return true; } catch (DaoException de) { if (de.getCause() instanceof DuplicateKeyException) { LOGGER.warn(de.getMessage(), de); return true; } if (de.getCause() instanceof ConcurrencyFailureException) { if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_queueWithRetries"); return _queueWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
java
protected boolean _queueWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { Date now = new Date(); msg.setNumRequeues(0).setQueueTimestamp(now).setTimestamp(now); return putToQueueStorage(conn, msg); } catch (DuplicatedValueException dve) { LOGGER.warn(dve.getMessage(), dve); return true; } catch (DaoException de) { if (de.getCause() instanceof DuplicateKeyException) { LOGGER.warn(de.getMessage(), de); return true; } if (de.getCause() instanceof ConcurrencyFailureException) { if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_queueWithRetries"); return _queueWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
[ "protected", "boolean", "_queueWithRetries", "(", "Connection", "conn", ",", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ",", "int", "numRetries", ",", "int", "maxRetries", ")", "{", "try", "{", "Date", "now", "=", "new", "Date", "(", ")", ";", ...
Queue a message, retry if deadlock. <p> Note: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html </p> <p> InnoDB uses automatic row-level locking. You can get deadlocks even in the case of transactions that just insert or delete a single row. That is because these operations are not really "atomic"; they automatically set locks on the (possibly several) index records of the row inserted or deleted. </p> <p> Note: the supplied queue message is mutable. </p> @param conn @param msg @param numRetries @param maxRetries @return
[ "Queue", "a", "message", "retry", "if", "deadlock", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java#L344-L370
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java
JdbcQueue._requeueWithRetries
protected boolean _requeueWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { jdbcHelper.startTransaction(conn); conn.setTransactionIsolation(transactionIsolationLevel); if (!isEphemeralDisabled()) { removeFromEphemeralStorage(conn, msg); } Date now = new Date(); msg.incNumRequeues().setQueueTimestamp(now); boolean result = putToQueueStorage(conn, msg); jdbcHelper.commitTransaction(conn); return result; } catch (DuplicatedValueException dve) { jdbcHelper.rollbackTransaction(conn); LOGGER.warn(dve.getMessage(), dve); return true; } catch (DaoException de) { if (de.getCause() instanceof DuplicateKeyException) { jdbcHelper.rollbackTransaction(conn); LOGGER.warn(de.getMessage(), de); return true; } if (de.getCause() instanceof ConcurrencyFailureException) { jdbcHelper.rollbackTransaction(conn); if (numRetries > maxRetries) { throw new QueueException(de); } else { /* * call _requeueSilentWithRetries(...) here is correct * because we do not want message's num-requeues is * increased with every retry */ incRetryCounter("_requeueWithRetries"); return _requeueSilentWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { jdbcHelper.rollbackTransaction(conn); throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
java
protected boolean _requeueWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { jdbcHelper.startTransaction(conn); conn.setTransactionIsolation(transactionIsolationLevel); if (!isEphemeralDisabled()) { removeFromEphemeralStorage(conn, msg); } Date now = new Date(); msg.incNumRequeues().setQueueTimestamp(now); boolean result = putToQueueStorage(conn, msg); jdbcHelper.commitTransaction(conn); return result; } catch (DuplicatedValueException dve) { jdbcHelper.rollbackTransaction(conn); LOGGER.warn(dve.getMessage(), dve); return true; } catch (DaoException de) { if (de.getCause() instanceof DuplicateKeyException) { jdbcHelper.rollbackTransaction(conn); LOGGER.warn(de.getMessage(), de); return true; } if (de.getCause() instanceof ConcurrencyFailureException) { jdbcHelper.rollbackTransaction(conn); if (numRetries > maxRetries) { throw new QueueException(de); } else { /* * call _requeueSilentWithRetries(...) here is correct * because we do not want message's num-requeues is * increased with every retry */ incRetryCounter("_requeueWithRetries"); return _requeueSilentWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { jdbcHelper.rollbackTransaction(conn); throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
[ "protected", "boolean", "_requeueWithRetries", "(", "Connection", "conn", ",", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ",", "int", "numRetries", ",", "int", "maxRetries", ")", "{", "try", "{", "jdbcHelper", ".", "startTransaction", "(", "conn", ...
Re-queue a message, retry if deadlock. <p> Note: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html </p> <p> InnoDB uses automatic row-level locking. You can get deadlocks even in the case of transactions that just insert or delete a single row. That is because these operations are not really "atomic"; they automatically set locks on the (possibly several) index records of the row inserted or deleted. </p> <p> Note: the supplied queue message is mutable. </p> @param conn @param msg @param numRetries @param maxRetries @return
[ "Re", "-", "queue", "a", "message", "retry", "if", "deadlock", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java#L416-L458
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java
JdbcQueue._finishWithRetries
protected void _finishWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { if (!isEphemeralDisabled()) { removeFromEphemeralStorage(conn, msg); } } catch (DaoException de) { if (de.getCause() instanceof ConcurrencyFailureException) { if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_finishWithRetries"); _finishWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
java
protected void _finishWithRetries(Connection conn, IQueueMessage<ID, DATA> msg, int numRetries, int maxRetries) { try { if (!isEphemeralDisabled()) { removeFromEphemeralStorage(conn, msg); } } catch (DaoException de) { if (de.getCause() instanceof ConcurrencyFailureException) { if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_finishWithRetries"); _finishWithRetries(conn, msg, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
[ "protected", "void", "_finishWithRetries", "(", "Connection", "conn", ",", "IQueueMessage", "<", "ID", ",", "DATA", ">", "msg", ",", "int", "numRetries", ",", "int", "maxRetries", ")", "{", "try", "{", "if", "(", "!", "isEphemeralDisabled", "(", ")", ")", ...
Perform "finish" action, retry if deadlock. <p> Note: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html </p> <p> InnoDB uses automatic row-level locking. You can get deadlocks even in the case of transactions that just insert or delete a single row. That is because these operations are not really "atomic"; they automatically set locks on the (possibly several) index records of the row inserted or deleted. </p> <p> Note: the supplied queue message is mutable. </p> @param conn @param msg @param numRetries @param maxRetries
[ "Perform", "finish", "action", "retry", "if", "deadlock", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java#L584-L603
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java
JdbcQueue._takeWithRetries
protected IQueueMessage<ID, DATA> _takeWithRetries(Connection conn, int numRetries, int maxRetries) { try { jdbcHelper.startTransaction(conn); conn.setTransactionIsolation(transactionIsolationLevel); boolean result = true; IQueueMessage<ID, DATA> msg = readFromQueueStorage(conn); if (msg != null) { result = result && removeFromQueueStorage(conn, msg); if (!isEphemeralDisabled()) { try { result = result && putToEphemeralStorage(conn, msg); } catch (DuplicatedValueException dve) { LOGGER.warn(dve.getMessage(), dve); } catch (DaoException de) { if (de.getCause() instanceof DuplicatedValueException) { LOGGER.warn(de.getMessage(), de); } else { throw de; } } } } if (result) { jdbcHelper.commitTransaction(conn); return msg; } else { jdbcHelper.rollbackTransaction(conn); return null; } } catch (DaoException de) { if (de.getCause() instanceof ConcurrencyFailureException) { jdbcHelper.rollbackTransaction(conn); if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_takeWithRetries"); return _takeWithRetries(conn, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { jdbcHelper.rollbackTransaction(conn); throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
java
protected IQueueMessage<ID, DATA> _takeWithRetries(Connection conn, int numRetries, int maxRetries) { try { jdbcHelper.startTransaction(conn); conn.setTransactionIsolation(transactionIsolationLevel); boolean result = true; IQueueMessage<ID, DATA> msg = readFromQueueStorage(conn); if (msg != null) { result = result && removeFromQueueStorage(conn, msg); if (!isEphemeralDisabled()) { try { result = result && putToEphemeralStorage(conn, msg); } catch (DuplicatedValueException dve) { LOGGER.warn(dve.getMessage(), dve); } catch (DaoException de) { if (de.getCause() instanceof DuplicatedValueException) { LOGGER.warn(de.getMessage(), de); } else { throw de; } } } } if (result) { jdbcHelper.commitTransaction(conn); return msg; } else { jdbcHelper.rollbackTransaction(conn); return null; } } catch (DaoException de) { if (de.getCause() instanceof ConcurrencyFailureException) { jdbcHelper.rollbackTransaction(conn); if (numRetries > maxRetries) { throw new QueueException(de); } else { incRetryCounter("_takeWithRetries"); return _takeWithRetries(conn, numRetries + 1, maxRetries); } } throw de; } catch (Exception e) { jdbcHelper.rollbackTransaction(conn); throw e instanceof QueueException ? (QueueException) e : new QueueException(e); } }
[ "protected", "IQueueMessage", "<", "ID", ",", "DATA", ">", "_takeWithRetries", "(", "Connection", "conn", ",", "int", "numRetries", ",", "int", "maxRetries", ")", "{", "try", "{", "jdbcHelper", ".", "startTransaction", "(", "conn", ")", ";", "conn", ".", "...
Take a message from queue, retry if deadlock. <p> Note: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html </p> <p> InnoDB uses automatic row-level locking. You can get deadlocks even in the case of transactions that just insert or delete a single row. That is because these operations are not really "atomic"; they automatically set locks on the (possibly several) index records of the row inserted or deleted. </p> @param conn @param numRetries @param maxRetries @return
[ "Take", "a", "message", "from", "queue", "retry", "if", "deadlock", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/JdbcQueue.java#L644-L690
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_1Generator.java
PHS398FellowshipSupplementalV1_1Generator.setQuestionnareAnswerForResearchTrainingPlan
private void setQuestionnareAnswerForResearchTrainingPlan( ResearchTrainingPlan researchTrainingPlan) { researchTrainingPlan.setHumanSubjectsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setVertebrateAnimalsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setHumanSubjectsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setClinicalTrial(YesNoDataType.N_NO); researchTrainingPlan.setPhase3ClinicalTrial(YesNoDataType.N_NO); for (AnswerContract questionnaireAnswer : getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(), getNamespace(), getFormName())) { String answer = questionnaireAnswer.getAnswer(); if (answer != null) { switch (getQuestionAnswerService().findQuestionById(questionnaireAnswer.getQuestionId()).getQuestionSeqId()) { case HUMAN: researchTrainingPlan .setHumanSubjectsIndefinite(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case VERT: researchTrainingPlan .setVertebrateAnimalsIndefinite(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case CLINICAL: researchTrainingPlan .setClinicalTrial(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case PHASE3CLINICAL: researchTrainingPlan .setPhase3ClinicalTrial(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; default: break; } } } }
java
private void setQuestionnareAnswerForResearchTrainingPlan( ResearchTrainingPlan researchTrainingPlan) { researchTrainingPlan.setHumanSubjectsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setVertebrateAnimalsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setHumanSubjectsIndefinite(YesNoDataType.N_NO); researchTrainingPlan.setClinicalTrial(YesNoDataType.N_NO); researchTrainingPlan.setPhase3ClinicalTrial(YesNoDataType.N_NO); for (AnswerContract questionnaireAnswer : getPropDevQuestionAnswerService().getQuestionnaireAnswers(pdDoc.getDevelopmentProposal().getProposalNumber(), getNamespace(), getFormName())) { String answer = questionnaireAnswer.getAnswer(); if (answer != null) { switch (getQuestionAnswerService().findQuestionById(questionnaireAnswer.getQuestionId()).getQuestionSeqId()) { case HUMAN: researchTrainingPlan .setHumanSubjectsIndefinite(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case VERT: researchTrainingPlan .setVertebrateAnimalsIndefinite(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case CLINICAL: researchTrainingPlan .setClinicalTrial(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; case PHASE3CLINICAL: researchTrainingPlan .setPhase3ClinicalTrial(answer .equals(YnqConstant.YES.code()) ? YesNoDataType.Y_YES : YesNoDataType.N_NO); break; default: break; } } } }
[ "private", "void", "setQuestionnareAnswerForResearchTrainingPlan", "(", "ResearchTrainingPlan", "researchTrainingPlan", ")", "{", "researchTrainingPlan", ".", "setHumanSubjectsIndefinite", "(", "YesNoDataType", ".", "N_NO", ")", ";", "researchTrainingPlan", ".", "setVertebrateA...
This method is used to set QuestionnareAnswer data to ResearchTrainingPlan XMLObject
[ "This", "method", "is", "used", "to", "set", "QuestionnareAnswer", "data", "to", "ResearchTrainingPlan", "XMLObject" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_1Generator.java#L556-L596
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasType.java
AliasType.transformKey
private String transformKey(String key, String src, String tgt) { StringBuilder sb = new StringBuilder(); String[] srcTokens = src.split(WILDCARD_DELIM_REGEX); String[] tgtTokens = tgt.split(WILDCARD_DELIM_REGEX); int len = Math.max(srcTokens.length, tgtTokens.length); int pos = 0; int start = 0; for (int i = 0; i <= len; i++) { String srcx = i >= srcTokens.length ? "" : srcTokens[i]; String tgtx = i >= tgtTokens.length ? "" : tgtTokens[i]; pos = i == len ? key.length() : pos; if ("*".equals(srcx) || "?".equals(srcx)) { start = pos; } else { pos = key.indexOf(srcx, pos); if (pos > start) { sb.append(key.substring(start, pos)); } start = pos += srcx.length(); sb.append(tgtx); } } return sb.toString(); }
java
private String transformKey(String key, String src, String tgt) { StringBuilder sb = new StringBuilder(); String[] srcTokens = src.split(WILDCARD_DELIM_REGEX); String[] tgtTokens = tgt.split(WILDCARD_DELIM_REGEX); int len = Math.max(srcTokens.length, tgtTokens.length); int pos = 0; int start = 0; for (int i = 0; i <= len; i++) { String srcx = i >= srcTokens.length ? "" : srcTokens[i]; String tgtx = i >= tgtTokens.length ? "" : tgtTokens[i]; pos = i == len ? key.length() : pos; if ("*".equals(srcx) || "?".equals(srcx)) { start = pos; } else { pos = key.indexOf(srcx, pos); if (pos > start) { sb.append(key.substring(start, pos)); } start = pos += srcx.length(); sb.append(tgtx); } } return sb.toString(); }
[ "private", "String", "transformKey", "(", "String", "key", ",", "String", "src", ",", "String", "tgt", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "String", "[", "]", "srcTokens", "=", "src", ".", "split", "(", "WILDCARD_...
Uses the source and target wildcard masks to transform an input key. @param key The input key. @param src The source wildcard mask. @param tgt The target wildcard mask. @return The transformed key.
[ "Uses", "the", "source", "and", "target", "wildcard", "masks", "to", "transform", "an", "input", "key", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasType.java#L117-L146
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java
ElementTreeView.afterMoveChild
@Override protected void afterMoveChild(ElementBase child, ElementBase before) { ElementTreePane childpane = (ElementTreePane) child; ElementTreePane beforepane = (ElementTreePane) before; moveChild(childpane.getNode(), beforepane.getNode()); }
java
@Override protected void afterMoveChild(ElementBase child, ElementBase before) { ElementTreePane childpane = (ElementTreePane) child; ElementTreePane beforepane = (ElementTreePane) before; moveChild(childpane.getNode(), beforepane.getNode()); }
[ "@", "Override", "protected", "void", "afterMoveChild", "(", "ElementBase", "child", ",", "ElementBase", "before", ")", "{", "ElementTreePane", "childpane", "=", "(", "ElementTreePane", ")", "child", ";", "ElementTreePane", "beforepane", "=", "(", "ElementTreePane",...
Only the node needs to be resequenced, since pane sequencing is arbitrary.
[ "Only", "the", "node", "needs", "to", "be", "resequenced", "since", "pane", "sequencing", "is", "arbitrary", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java#L70-L75
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java
ElementTreeView.setSelectionStyle
public void setSelectionStyle(ThemeUtil.ButtonStyle selectionStyle) { if (activePane != null) { activePane.updateSelectionStyle(this.selectionStyle, selectionStyle); } this.selectionStyle = selectionStyle; }
java
public void setSelectionStyle(ThemeUtil.ButtonStyle selectionStyle) { if (activePane != null) { activePane.updateSelectionStyle(this.selectionStyle, selectionStyle); } this.selectionStyle = selectionStyle; }
[ "public", "void", "setSelectionStyle", "(", "ThemeUtil", ".", "ButtonStyle", "selectionStyle", ")", "{", "if", "(", "activePane", "!=", "null", ")", "{", "activePane", ".", "updateSelectionStyle", "(", "this", ".", "selectionStyle", ",", "selectionStyle", ")", "...
Sets the button style to use for selected nodes. @param selectionStyle Button style for selected nodes.
[ "Sets", "the", "button", "style", "to", "use", "for", "selected", "nodes", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java#L127-L133
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java
ElementTreeView.afterRemoveChild
@Override protected void afterRemoveChild(ElementBase child) { if (child == activePane) { setActivePane((ElementTreePane) getFirstChild()); } super.afterRemoveChild(child); }
java
@Override protected void afterRemoveChild(ElementBase child) { if (child == activePane) { setActivePane((ElementTreePane) getFirstChild()); } super.afterRemoveChild(child); }
[ "@", "Override", "protected", "void", "afterRemoveChild", "(", "ElementBase", "child", ")", "{", "if", "(", "child", "==", "activePane", ")", "{", "setActivePane", "(", "(", "ElementTreePane", ")", "getFirstChild", "(", ")", ")", ";", "}", "super", ".", "a...
Remove the associated tree node when a tree pane is removed.
[ "Remove", "the", "associated", "tree", "node", "when", "a", "tree", "pane", "is", "removed", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java#L138-L144
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java
ElementTreeView.activateChildren
@Override public void activateChildren(boolean activate) { if (activePane == null || !activePane.isVisible()) { ElementBase active = getFirstVisibleChild(); setActivePane((ElementTreePane) active); } if (activePane != null) { activePane.activate(activate); } }
java
@Override public void activateChildren(boolean activate) { if (activePane == null || !activePane.isVisible()) { ElementBase active = getFirstVisibleChild(); setActivePane((ElementTreePane) active); } if (activePane != null) { activePane.activate(activate); } }
[ "@", "Override", "public", "void", "activateChildren", "(", "boolean", "activate", ")", "{", "if", "(", "activePane", "==", "null", "||", "!", "activePane", ".", "isVisible", "(", ")", ")", "{", "ElementBase", "active", "=", "getFirstVisibleChild", "(", ")",...
Only the active pane should receive the activation request.
[ "Only", "the", "active", "pane", "should", "receive", "the", "activation", "request", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java#L158-L168
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java
ElementTreeView.setActivePane
protected void setActivePane(ElementTreePane pane) { if (pane == activePane) { return; } if (activePane != null) { activePane.makeActivePane(false); } activePane = pane; if (activePane != null) { activePane.makeActivePane(true); } }
java
protected void setActivePane(ElementTreePane pane) { if (pane == activePane) { return; } if (activePane != null) { activePane.makeActivePane(false); } activePane = pane; if (activePane != null) { activePane.makeActivePane(true); } }
[ "protected", "void", "setActivePane", "(", "ElementTreePane", "pane", ")", "{", "if", "(", "pane", "==", "activePane", ")", "{", "return", ";", "}", "if", "(", "activePane", "!=", "null", ")", "{", "activePane", ".", "makeActivePane", "(", "false", ")", ...
Activates the specified pane. Any previously active pane will be deactivated. @param pane Pane to make active.
[ "Activates", "the", "specified", "pane", ".", "Any", "previously", "active", "pane", "will", "be", "deactivated", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementTreeView.java#L175-L189
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java
AliasTypeRegistry.get
@Override public AliasType get(String key) { key = key.toUpperCase(); AliasType type = super.get(key); if (type == null) { register(type = new AliasType(key)); } return type; }
java
@Override public AliasType get(String key) { key = key.toUpperCase(); AliasType type = super.get(key); if (type == null) { register(type = new AliasType(key)); } return type; }
[ "@", "Override", "public", "AliasType", "get", "(", "String", "key", ")", "{", "key", "=", "key", ".", "toUpperCase", "(", ")", ";", "AliasType", "type", "=", "super", ".", "get", "(", "key", ")", ";", "if", "(", "type", "==", "null", ")", "{", "...
Returns the AliasType given the key, creating and registering it if it does not already exist. @param key Unique key of alias type. @return The alias type (never null).
[ "Returns", "the", "AliasType", "given", "the", "key", "creating", "and", "registering", "it", "if", "it", "does", "not", "already", "exist", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java#L116-L126
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java
AliasTypeRegistry.setApplicationContext
@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (StringUtils.isEmpty(propertyFile)) { return; } for (String pf : propertyFile.split("\\,")) { loadAliases(applicationContext, pf); } if (fileCount > 0) { log.info("Loaded " + entryCount + " aliases from " + fileCount + " files."); } }
java
@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { if (StringUtils.isEmpty(propertyFile)) { return; } for (String pf : propertyFile.split("\\,")) { loadAliases(applicationContext, pf); } if (fileCount > 0) { log.info("Loaded " + entryCount + " aliases from " + fileCount + " files."); } }
[ "@", "Override", "public", "void", "setApplicationContext", "(", "ApplicationContext", "applicationContext", ")", "throws", "BeansException", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "propertyFile", ")", ")", "{", "return", ";", "}", "for", "(", "Stri...
Loads aliases defined in an external property file, if specified.
[ "Loads", "aliases", "defined", "in", "an", "external", "property", "file", "if", "specified", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java#L131-L144
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java
AliasTypeRegistry.loadAliases
private void loadAliases(ApplicationContext applicationContext, String propertyFile) { if (propertyFile.isEmpty()) { return; } Resource[] resources; try { resources = applicationContext.getResources(propertyFile); } catch (IOException e) { log.error("Failed to locate alias property file: " + propertyFile, e); return; } for (Resource resource : resources) { if (!resource.exists()) { log.info("Did not find alias property file: " + resource.getFilename()); continue; } try (InputStream is = resource.getInputStream();) { Properties props = new Properties(); props.load(is); for (Entry<Object, Object> entry : props.entrySet()) { try { register((String) entry.getKey(), (String) entry.getValue()); entryCount++; } catch (Exception e) { log.error("Error registering alias for '" + entry.getKey() + "'.", e); } } fileCount++; } catch (IOException e) { log.error("Failed to load alias property file: " + resource.getFilename(), e); } } }
java
private void loadAliases(ApplicationContext applicationContext, String propertyFile) { if (propertyFile.isEmpty()) { return; } Resource[] resources; try { resources = applicationContext.getResources(propertyFile); } catch (IOException e) { log.error("Failed to locate alias property file: " + propertyFile, e); return; } for (Resource resource : resources) { if (!resource.exists()) { log.info("Did not find alias property file: " + resource.getFilename()); continue; } try (InputStream is = resource.getInputStream();) { Properties props = new Properties(); props.load(is); for (Entry<Object, Object> entry : props.entrySet()) { try { register((String) entry.getKey(), (String) entry.getValue()); entryCount++; } catch (Exception e) { log.error("Error registering alias for '" + entry.getKey() + "'.", e); } } fileCount++; } catch (IOException e) { log.error("Failed to load alias property file: " + resource.getFilename(), e); } } }
[ "private", "void", "loadAliases", "(", "ApplicationContext", "applicationContext", ",", "String", "propertyFile", ")", "{", "if", "(", "propertyFile", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "Resource", "[", "]", "resources", ";", "try", "{",...
Load aliases from a property file. @param applicationContext The application context. @param propertyFile A property file.
[ "Load", "aliases", "from", "a", "property", "file", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java#L152-L191
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java
AliasTypeRegistry.register
private void register(String key, String alias) { String[] pcs = key.split(PREFIX_DELIM_REGEX, 2); if (pcs.length != 2) { throw new IllegalArgumentException("Illegal key value: " + key); } register(pcs[0], pcs[1], alias); }
java
private void register(String key, String alias) { String[] pcs = key.split(PREFIX_DELIM_REGEX, 2); if (pcs.length != 2) { throw new IllegalArgumentException("Illegal key value: " + key); } register(pcs[0], pcs[1], alias); }
[ "private", "void", "register", "(", "String", "key", ",", "String", "alias", ")", "{", "String", "[", "]", "pcs", "=", "key", ".", "split", "(", "PREFIX_DELIM_REGEX", ",", "2", ")", ";", "if", "(", "pcs", ".", "length", "!=", "2", ")", "{", "throw"...
Registers an alias for a key prefixed with an alias type. @param key Local name with alias type prefix. @param alias Alias for the key. A null value removes any existing alias.
[ "Registers", "an", "alias", "for", "a", "key", "prefixed", "with", "an", "alias", "type", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/alias/AliasTypeRegistry.java#L199-L207
train
mgormley/prim
src/main/java/edu/jhu/prim/tuple/ComparablePair.java
ComparablePair.naturalOrder
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() { return new Comparator<Pair<T1,T2>>() { @Override public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) { return compareTo(lhs, rhs); } }; }
java
public static <T1 extends Comparable<T1>, T2 extends Comparable<T2>> Comparator<Pair<T1, T2>> naturalOrder() { return new Comparator<Pair<T1,T2>>() { @Override public int compare(Pair<T1, T2> lhs, Pair<T1, T2> rhs) { return compareTo(lhs, rhs); } }; }
[ "public", "static", "<", "T1", "extends", "Comparable", "<", "T1", ">", ",", "T2", "extends", "Comparable", "<", "T2", ">", ">", "Comparator", "<", "Pair", "<", "T1", ",", "T2", ">", ">", "naturalOrder", "(", ")", "{", "return", "new", "Comparator", ...
creates a natural order for pairs of comparable things @return
[ "creates", "a", "natural", "order", "for", "pairs", "of", "comparable", "things" ]
5dce5e1ae94a9ae558a6262fc246e1a24f56686c
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/tuple/ComparablePair.java#L33-L42
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398ResearchPlanBaseGenerator.java
PHS398ResearchPlanBaseGenerator.getAppendixAttachedFileDataTypes
protected AttachedFileDataType[] getAppendixAttachedFileDataTypes() { return pdDoc.getDevelopmentProposal().getNarratives().stream() .filter(narrative -> narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == APPENDIX) .map(this::getAttachedFileType) .filter(Objects::nonNull) .toArray(AttachedFileDataType[]::new); }
java
protected AttachedFileDataType[] getAppendixAttachedFileDataTypes() { return pdDoc.getDevelopmentProposal().getNarratives().stream() .filter(narrative -> narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == APPENDIX) .map(this::getAttachedFileType) .filter(Objects::nonNull) .toArray(AttachedFileDataType[]::new); }
[ "protected", "AttachedFileDataType", "[", "]", "getAppendixAttachedFileDataTypes", "(", ")", "{", "return", "pdDoc", ".", "getDevelopmentProposal", "(", ")", ".", "getNarratives", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "narrative", "->", "narrati...
This method is used to get List of appendix attachments from NarrativeAttachment @return AttachedFileDataType[] array of attachments for the corresponding narrative type code APPENDIX.
[ "This", "method", "is", "used", "to", "get", "List", "of", "appendix", "attachments", "from", "NarrativeAttachment" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398ResearchPlanBaseGenerator.java#L64-L70
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java
S2SAdobeFormAttachmentBaseGenerator.nodeToDom
public Document nodeToDom(org.w3c.dom.Node node) throws S2SException { try { javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance(); javax.xml.transform.Transformer xf = tf.newTransformer(); javax.xml.transform.dom.DOMResult dr = new javax.xml.transform.dom.DOMResult(); xf.transform(new javax.xml.transform.dom.DOMSource(node), dr); return (Document) dr.getNode(); } catch (javax.xml.transform.TransformerException ex) { throw new S2SException(ex.getMessage()); } }
java
public Document nodeToDom(org.w3c.dom.Node node) throws S2SException { try { javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance(); javax.xml.transform.Transformer xf = tf.newTransformer(); javax.xml.transform.dom.DOMResult dr = new javax.xml.transform.dom.DOMResult(); xf.transform(new javax.xml.transform.dom.DOMSource(node), dr); return (Document) dr.getNode(); } catch (javax.xml.transform.TransformerException ex) { throw new S2SException(ex.getMessage()); } }
[ "public", "Document", "nodeToDom", "(", "org", ".", "w3c", ".", "dom", ".", "Node", "node", ")", "throws", "S2SException", "{", "try", "{", "javax", ".", "xml", ".", "transform", ".", "TransformerFactory", "tf", "=", "javax", ".", "xml", ".", "transform"...
This method convert node of form in to a Document @param node n {Node} node entry. @return Document containing doc information
[ "This", "method", "convert", "node", "of", "form", "in", "to", "a", "Document" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java#L90-L102
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java
S2SAdobeFormAttachmentBaseGenerator.stringToDom
public Document stringToDom(String xmlSource) throws S2SException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } catch (SAXException | IOException | ParserConfigurationException ex) { throw new S2SException(ex.getMessage(), ex); } }
java
public Document stringToDom(String xmlSource) throws S2SException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.parse(new InputSource(new StringReader(xmlSource))); } catch (SAXException | IOException | ParserConfigurationException ex) { throw new S2SException(ex.getMessage(), ex); } }
[ "public", "Document", "stringToDom", "(", "String", "xmlSource", ")", "throws", "S2SException", "{", "try", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setNamespaceAware", "(", "true", ...
This method convert xml string in to a Document @param xmlSource {xml String} xml source entry. @return Document containing doc information
[ "This", "method", "convert", "xml", "string", "in", "to", "a", "Document" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java#L111-L121
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java
S2SAdobeFormAttachmentBaseGenerator.docToString
public String docToString(Document node) throws S2SException { try { DOMSource domSource = new DOMSource(node); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); return writer.toString(); } catch (Exception e) { throw new S2SException(e.getMessage(),e); } }
java
public String docToString(Document node) throws S2SException { try { DOMSource domSource = new DOMSource(node); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer = tf.newTransformer(); transformer.transform(domSource, result); return writer.toString(); } catch (Exception e) { throw new S2SException(e.getMessage(),e); } }
[ "public", "String", "docToString", "(", "Document", "node", ")", "throws", "S2SException", "{", "try", "{", "DOMSource", "domSource", "=", "new", "DOMSource", "(", "node", ")", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "Stream...
This method convert Document to a String @param node {Document} node entry. @return String containing doc information
[ "This", "method", "convert", "Document", "to", "a", "String" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java#L139-L152
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java
S2SAdobeFormAttachmentBaseGenerator.addSubAwdAttachments
protected void addSubAwdAttachments(BudgetSubAwardsContract budgetSubAwards) { List<? extends BudgetSubAwardAttachmentContract> subAwardAttachments = budgetSubAwards.getBudgetSubAwardAttachments(); for (BudgetSubAwardAttachmentContract budgetSubAwardAttachment : subAwardAttachments) { AttachmentData attachmentData = new AttachmentData(); attachmentData.setContent(budgetSubAwardAttachment.getData()); attachmentData.setContentId(budgetSubAwardAttachment.getName()); attachmentData.setContentType(budgetSubAwardAttachment.getType()); attachmentData.setFileName(budgetSubAwardAttachment.getName()); addAttachment(attachmentData); } }
java
protected void addSubAwdAttachments(BudgetSubAwardsContract budgetSubAwards) { List<? extends BudgetSubAwardAttachmentContract> subAwardAttachments = budgetSubAwards.getBudgetSubAwardAttachments(); for (BudgetSubAwardAttachmentContract budgetSubAwardAttachment : subAwardAttachments) { AttachmentData attachmentData = new AttachmentData(); attachmentData.setContent(budgetSubAwardAttachment.getData()); attachmentData.setContentId(budgetSubAwardAttachment.getName()); attachmentData.setContentType(budgetSubAwardAttachment.getType()); attachmentData.setFileName(budgetSubAwardAttachment.getName()); addAttachment(attachmentData); } }
[ "protected", "void", "addSubAwdAttachments", "(", "BudgetSubAwardsContract", "budgetSubAwards", ")", "{", "List", "<", "?", "extends", "BudgetSubAwardAttachmentContract", ">", "subAwardAttachments", "=", "budgetSubAwards", ".", "getBudgetSubAwardAttachments", "(", ")", ";",...
Adding attachments to subaward
[ "Adding", "attachments", "to", "subaward" ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java#L247-L257
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java
S2SAdobeFormAttachmentBaseGenerator.findBudgetSubawards
@SuppressWarnings("unchecked") private List<BudgetSubAwardsContract> findBudgetSubawards(String namespace, BudgetContract budget,boolean checkNull) { List<BudgetSubAwardsContract> budgetSubAwardsList = new ArrayList<>(); for (BudgetSubAwardsContract subAwards : budget.getBudgetSubAwards()) { if (StringUtils.equals(namespace, subAwards.getNamespace()) || (checkNull && StringUtils.isBlank(subAwards.getNamespace()))) { budgetSubAwardsList.add(subAwards); } } return budgetSubAwardsList; }
java
@SuppressWarnings("unchecked") private List<BudgetSubAwardsContract> findBudgetSubawards(String namespace, BudgetContract budget,boolean checkNull) { List<BudgetSubAwardsContract> budgetSubAwardsList = new ArrayList<>(); for (BudgetSubAwardsContract subAwards : budget.getBudgetSubAwards()) { if (StringUtils.equals(namespace, subAwards.getNamespace()) || (checkNull && StringUtils.isBlank(subAwards.getNamespace()))) { budgetSubAwardsList.add(subAwards); } } return budgetSubAwardsList; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "List", "<", "BudgetSubAwardsContract", ">", "findBudgetSubawards", "(", "String", "namespace", ",", "BudgetContract", "budget", ",", "boolean", "checkNull", ")", "{", "List", "<", "BudgetSubAwardsContract...
This method is to find the subaward budget BOs for the given namespace.
[ "This", "method", "is", "to", "find", "the", "subaward", "budget", "BOs", "for", "the", "given", "namespace", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/S2SAdobeFormAttachmentBaseGenerator.java#L284-L294
train
wcm-io-caravan/caravan-commons
performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java
PerformanceMetrics.createNew
public static PerformanceMetrics createNew(String action, String descriptor, String correlationId) { return new PerformanceMetrics(KEY_GEN.getAndIncrement(), 0, action, null, descriptor, correlationId); }
java
public static PerformanceMetrics createNew(String action, String descriptor, String correlationId) { return new PerformanceMetrics(KEY_GEN.getAndIncrement(), 0, action, null, descriptor, correlationId); }
[ "public", "static", "PerformanceMetrics", "createNew", "(", "String", "action", ",", "String", "descriptor", ",", "String", "correlationId", ")", "{", "return", "new", "PerformanceMetrics", "(", "KEY_GEN", ".", "getAndIncrement", "(", ")", ",", "0", ",", "action...
Creates new instance of performance metrics. Generates new metrics key and assigns zero level. @param action a short name of measured operation, typically a first prefix of descriptor @param descriptor a full description of measured operation @param correlationId a reference to the request, which caused the operation @return PerformanceMetrics a new instance of performance metrics
[ "Creates", "new", "instance", "of", "performance", "metrics", ".", "Generates", "new", "metrics", "key", "and", "assigns", "zero", "level", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java#L71-L73
train
wcm-io-caravan/caravan-commons
performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java
PerformanceMetrics.getStartAction
public Action0 getStartAction() { return new Action0() { @Override public void call() { if (startTime == null) { startTime = new Date().getTime(); } } }; }
java
public Action0 getStartAction() { return new Action0() { @Override public void call() { if (startTime == null) { startTime = new Date().getTime(); } } }; }
[ "public", "Action0", "getStartAction", "(", ")", "{", "return", "new", "Action0", "(", ")", "{", "@", "Override", "public", "void", "call", "(", ")", "{", "if", "(", "startTime", "==", "null", ")", "{", "startTime", "=", "new", "Date", "(", ")", ".",...
When called, start action sets time stamp to identify start time of operation. @return Action0
[ "When", "called", "start", "action", "sets", "time", "stamp", "to", "identify", "start", "time", "of", "operation", "." ]
12e605bdfeb5a1ce7404e30d9f32274552cb8ce8
https://github.com/wcm-io-caravan/caravan-commons/blob/12e605bdfeb5a1ce7404e30d9f32274552cb8ce8/performance/src/main/java/io/wcm/caravan/common/performance/PerformanceMetrics.java#L106-L115
train
ologolo/streamline-engine
src/org/daisy/streamline/engine/PathTools.java
PathTools.createTempFolder
public static Path createTempFolder(String prefix) throws IOException { Path parent = Paths.get(System.getProperty("java.io.tmpdir")); if (!Files.isDirectory(parent)) { throw new IOException("java.io.tmpdir points to a non-existing folder: " + parent); } Path ret = null; int i = 0; do { ret = parent.resolve(Objects.requireNonNull(prefix)+Long.toHexString(System.currentTimeMillis())+"-"+Integer.toHexString(RND.nextInt())); i++; if (i>=100) { throw new IOException("Failed to create temporary folder."); } } while (!ret.toFile().mkdirs()); return ret; }
java
public static Path createTempFolder(String prefix) throws IOException { Path parent = Paths.get(System.getProperty("java.io.tmpdir")); if (!Files.isDirectory(parent)) { throw new IOException("java.io.tmpdir points to a non-existing folder: " + parent); } Path ret = null; int i = 0; do { ret = parent.resolve(Objects.requireNonNull(prefix)+Long.toHexString(System.currentTimeMillis())+"-"+Integer.toHexString(RND.nextInt())); i++; if (i>=100) { throw new IOException("Failed to create temporary folder."); } } while (!ret.toFile().mkdirs()); return ret; }
[ "public", "static", "Path", "createTempFolder", "(", "String", "prefix", ")", "throws", "IOException", "{", "Path", "parent", "=", "Paths", ".", "get", "(", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ")", ";", "if", "(", "!", "Files", "....
Creates a temporary folder. @param prefix a folder prefix @return the temporary folder @throws IOException if a folder could not be created @throws NullPointerException if {@code prefix} is null
[ "Creates", "a", "temporary", "folder", "." ]
04b7adc85d84d91dc5f0eaaa401d2738f9401b17
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/PathTools.java#L38-L53
train
ologolo/streamline-engine
src/org/daisy/streamline/engine/PathTools.java
PathTools.deleteRecursive
public static void deleteRecursive(Path start, boolean deleteStart) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { if (deleteStart || !Files.isSameFile(dir, start)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } else { // directory iteration failed throw e; } } }); }
java
public static void deleteRecursive(Path start, boolean deleteStart) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e == null) { if (deleteStart || !Files.isSameFile(dir, start)) { Files.delete(dir); } return FileVisitResult.CONTINUE; } else { // directory iteration failed throw e; } } }); }
[ "public", "static", "void", "deleteRecursive", "(", "Path", "start", ",", "boolean", "deleteStart", ")", "throws", "IOException", "{", "Files", ".", "walkFileTree", "(", "start", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Overrid...
Deletes files and folders at the specified path. @param start the path @param deleteStart true if the start path should also be deleted, false if only the contents should be deleted @throws IOException if an I/O error occurs
[ "Deletes", "files", "and", "folders", "at", "the", "specified", "path", "." ]
04b7adc85d84d91dc5f0eaaa401d2738f9401b17
https://github.com/ologolo/streamline-engine/blob/04b7adc85d84d91dc5f0eaaa401d2738f9401b17/src/org/daisy/streamline/engine/PathTools.java#L70-L90
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java
MainController.afterInitialized
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); propertyGrid = PropertyGrid.create(null, comp, true); getPlugin().registerProperties(this, "provider", "group"); }
java
@Override public void afterInitialized(BaseComponent comp) { super.afterInitialized(comp); propertyGrid = PropertyGrid.create(null, comp, true); getPlugin().registerProperties(this, "provider", "group"); }
[ "@", "Override", "public", "void", "afterInitialized", "(", "BaseComponent", "comp", ")", "{", "super", ".", "afterInitialized", "(", "comp", ")", ";", "propertyGrid", "=", "PropertyGrid", ".", "create", "(", "null", ",", "comp", ",", "true", ")", ";", "ge...
Connects an embedded instance of the property grid to the plug-in's root component.
[ "Connects", "an", "embedded", "instance", "of", "the", "property", "grid", "to", "the", "plug", "-", "in", "s", "root", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java#L51-L56
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java
MainController.setProvider
public void setProvider(String beanId) { provider = getAppContext().getBean(beanId, ISettingsProvider.class); providerBeanId = beanId; init(); }
java
public void setProvider(String beanId) { provider = getAppContext().getBean(beanId, ISettingsProvider.class); providerBeanId = beanId; init(); }
[ "public", "void", "setProvider", "(", "String", "beanId", ")", "{", "provider", "=", "getAppContext", "(", ")", ".", "getBean", "(", "beanId", ",", "ISettingsProvider", ".", "class", ")", ";", "providerBeanId", "=", "beanId", ";", "init", "(", ")", ";", ...
Sets the id of the bean that implements the ISettingsProvider interface. @param beanId The bean id.
[ "Sets", "the", "id", "of", "the", "bean", "that", "implements", "the", "ISettingsProvider", "interface", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java#L72-L76
train
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java
MainController.init
private void init() { if (provider != null) { propertyGrid.setTarget(StringUtils.isEmpty(groupId) ? null : new Settings(groupId, provider)); } }
java
private void init() { if (provider != null) { propertyGrid.setTarget(StringUtils.isEmpty(groupId) ? null : new Settings(groupId, provider)); } }
[ "private", "void", "init", "(", ")", "{", "if", "(", "provider", "!=", "null", ")", "{", "propertyGrid", ".", "setTarget", "(", "StringUtils", ".", "isEmpty", "(", "groupId", ")", "?", "null", ":", "new", "Settings", "(", "groupId", ",", "provider", ")...
Activates the property grid once the provider and group ids are set.
[ "Activates", "the", "property", "grid", "once", "the", "provider", "and", "group", "ids", "are", "set", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.settings/src/main/java/org/carewebframework/plugin/settings/MainController.java#L100-L104
train
strator-dev/greenpepper
greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/utils/FixtureAnnotationClassScanner.java
FixtureAnnotationClassScanner.addCollectionProviderFixtureType
private void addCollectionProviderFixtureType(Class<?> clazz, List<FixtureType> listFixtureType, Set<Method> methods) { for (Method method : methods) { if (Collection.class.isAssignableFrom(method.getReturnType())) { FixtureType fixtureType = new FixtureType(); if (method.isAnnotationPresent(FixtureCollection.class)) { FixtureCollection annotation = method.getAnnotation(FixtureCollection.class); if (annotation.deprecated()) { fixtureType.setDeprecated(annotation.deprecated()); } else { fixtureType.setBestpractice(annotation.bestPractice()); } } Type genericReturnType = method.getGenericReturnType(); Class<?> typeClass; if (ParameterizedType.class.isAssignableFrom(genericReturnType.getClass())) { ParameterizedType parameterizedReturnType = (ParameterizedType) genericReturnType; LOGGER.debug("Checking the Collection Generic type: {}", parameterizedReturnType); typeClass = (Class<?>) parameterizedReturnType.getActualTypeArguments()[0]; } else { // We take the Object class typeClass = Object.class; } fixtureType.setClazz(returnTypeToString(clazz) + "/" + method.getName()); List<MemberType> listMembreType = fixtureType.getMember(); if (Modifier.isAbstract(clazz.getModifiers())) { fixtureType.setCategory(CAT_FIXTURES_ABSTRAITES); } else { @SuppressWarnings("unchecked") Set<Field> allFields = getAllFields(typeClass, and(or(withModifier(Modifier.PUBLIC), withModifier(Modifier.PRIVATE)), not(withModifier(Modifier.STATIC)))); for (Field field : allFields) { MemberType membreType = new MemberType(); membreType.setName(field.getName()); membreType.setType(TypeMemberEnum.QUERY); membreType.setReturntype(returnTypeToString(field.getType().getSimpleName())); listMembreType.add(membreType); } } listFixtureType.add(fixtureType); } else { LOGGER.warn("A method matching the CollectionIterpreter is not returning a Collection: {}", method.toString()); } } }
java
private void addCollectionProviderFixtureType(Class<?> clazz, List<FixtureType> listFixtureType, Set<Method> methods) { for (Method method : methods) { if (Collection.class.isAssignableFrom(method.getReturnType())) { FixtureType fixtureType = new FixtureType(); if (method.isAnnotationPresent(FixtureCollection.class)) { FixtureCollection annotation = method.getAnnotation(FixtureCollection.class); if (annotation.deprecated()) { fixtureType.setDeprecated(annotation.deprecated()); } else { fixtureType.setBestpractice(annotation.bestPractice()); } } Type genericReturnType = method.getGenericReturnType(); Class<?> typeClass; if (ParameterizedType.class.isAssignableFrom(genericReturnType.getClass())) { ParameterizedType parameterizedReturnType = (ParameterizedType) genericReturnType; LOGGER.debug("Checking the Collection Generic type: {}", parameterizedReturnType); typeClass = (Class<?>) parameterizedReturnType.getActualTypeArguments()[0]; } else { // We take the Object class typeClass = Object.class; } fixtureType.setClazz(returnTypeToString(clazz) + "/" + method.getName()); List<MemberType> listMembreType = fixtureType.getMember(); if (Modifier.isAbstract(clazz.getModifiers())) { fixtureType.setCategory(CAT_FIXTURES_ABSTRAITES); } else { @SuppressWarnings("unchecked") Set<Field> allFields = getAllFields(typeClass, and(or(withModifier(Modifier.PUBLIC), withModifier(Modifier.PRIVATE)), not(withModifier(Modifier.STATIC)))); for (Field field : allFields) { MemberType membreType = new MemberType(); membreType.setName(field.getName()); membreType.setType(TypeMemberEnum.QUERY); membreType.setReturntype(returnTypeToString(field.getType().getSimpleName())); listMembreType.add(membreType); } } listFixtureType.add(fixtureType); } else { LOGGER.warn("A method matching the CollectionIterpreter is not returning a Collection: {}", method.toString()); } } }
[ "private", "void", "addCollectionProviderFixtureType", "(", "Class", "<", "?", ">", "clazz", ",", "List", "<", "FixtureType", ">", "listFixtureType", ",", "Set", "<", "Method", ">", "methods", ")", "{", "for", "(", "Method", "method", ":", "methods", ")", ...
Parsing des FixtureCollection.
[ "Parsing", "des", "FixtureCollection", "." ]
2a61e6c179b74085babcc559d677490b0cad2d30
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/utils/FixtureAnnotationClassScanner.java#L181-L232
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java
Command.unbind
public void unbind(BaseUIComponent component) { if (componentBindings.remove(component)) { keyEventListener.registerComponent(component, false); CommandUtil.updateShortcuts(component, shortcutBindings, true); setCommandTarget(component, null); } }
java
public void unbind(BaseUIComponent component) { if (componentBindings.remove(component)) { keyEventListener.registerComponent(component, false); CommandUtil.updateShortcuts(component, shortcutBindings, true); setCommandTarget(component, null); } }
[ "public", "void", "unbind", "(", "BaseUIComponent", "component", ")", "{", "if", "(", "componentBindings", ".", "remove", "(", "component", ")", ")", "{", "keyEventListener", ".", "registerComponent", "(", "component", ",", "false", ")", ";", "CommandUtil", "....
Unbind a component from this command. @param component The component to unbind.
[ "Unbind", "a", "component", "from", "this", "command", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java#L162-L168
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java
Command.shortcutChanged
private void shortcutChanged(String shortcut, boolean unbind) { Set<String> bindings = new HashSet<>(); bindings.add(shortcut); for (BaseUIComponent component : componentBindings) { CommandUtil.updateShortcuts(component, bindings, unbind); } }
java
private void shortcutChanged(String shortcut, boolean unbind) { Set<String> bindings = new HashSet<>(); bindings.add(shortcut); for (BaseUIComponent component : componentBindings) { CommandUtil.updateShortcuts(component, bindings, unbind); } }
[ "private", "void", "shortcutChanged", "(", "String", "shortcut", ",", "boolean", "unbind", ")", "{", "Set", "<", "String", ">", "bindings", "=", "new", "HashSet", "<>", "(", ")", ";", "bindings", ".", "add", "(", "shortcut", ")", ";", "for", "(", "Base...
Called when a shortcut is bound or unbound. @param shortcut The shortcut that has been bound or unbound. @param unbind If true, the shortcut is being unbound.
[ "Called", "when", "a", "shortcut", "is", "bound", "or", "unbound", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java#L187-L194
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java
Command.setCommandTarget
private void setCommandTarget(BaseComponent component, BaseComponent commandTarget) { if (commandTarget == null) { commandTarget = (BaseComponent) component.removeAttribute(getTargetAttributeName()); if (commandTarget != null && commandTarget.hasAttribute(ATTR_DUMMY)) { commandTarget.detach(); } } else { component.setAttribute(getTargetAttributeName(), commandTarget); } }
java
private void setCommandTarget(BaseComponent component, BaseComponent commandTarget) { if (commandTarget == null) { commandTarget = (BaseComponent) component.removeAttribute(getTargetAttributeName()); if (commandTarget != null && commandTarget.hasAttribute(ATTR_DUMMY)) { commandTarget.detach(); } } else { component.setAttribute(getTargetAttributeName(), commandTarget); } }
[ "private", "void", "setCommandTarget", "(", "BaseComponent", "component", ",", "BaseComponent", "commandTarget", ")", "{", "if", "(", "commandTarget", "==", "null", ")", "{", "commandTarget", "=", "(", "BaseComponent", ")", "component", ".", "removeAttribute", "("...
Sets or removes the command target for the specified component. @param component The bound component whose command target is being modified. @param commandTarget If null, any associated command target is removed. Otherwise, this value is set as the command target.
[ "Sets", "or", "removes", "the", "command", "target", "for", "the", "specified", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java#L250-L260
train
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java
Command.getCommandTarget
private BaseComponent getCommandTarget(BaseComponent component) { BaseComponent commandTarget = (BaseComponent) component.getAttribute(getTargetAttributeName()); return commandTarget == null ? component : commandTarget; }
java
private BaseComponent getCommandTarget(BaseComponent component) { BaseComponent commandTarget = (BaseComponent) component.getAttribute(getTargetAttributeName()); return commandTarget == null ? component : commandTarget; }
[ "private", "BaseComponent", "getCommandTarget", "(", "BaseComponent", "component", ")", "{", "BaseComponent", "commandTarget", "=", "(", "BaseComponent", ")", "component", ".", "getAttribute", "(", "getTargetAttributeName", "(", ")", ")", ";", "return", "commandTarget...
Returns the command target associated with the specified component. @param component The component whose command target is sought. @return The associated command target. If there is no associated command target, returns the component itself (i.e., the component is the command target).
[ "Returns", "the", "command", "target", "associated", "with", "the", "specified", "component", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/Command.java#L269-L272
train
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpModule.java
HelpModule.getLocalizedId
public static String getLocalizedId(String id, Locale locale) { String locstr = locale == null ? "" : ("_" + locale.toString()); return id + locstr; }
java
public static String getLocalizedId(String id, Locale locale) { String locstr = locale == null ? "" : ("_" + locale.toString()); return id + locstr; }
[ "public", "static", "String", "getLocalizedId", "(", "String", "id", ",", "Locale", "locale", ")", "{", "String", "locstr", "=", "locale", "==", "null", "?", "\"\"", ":", "(", "\"_\"", "+", "locale", ".", "toString", "(", ")", ")", ";", "return", "id",...
Adds locale information to a help module id. @param id Help module id. @param locale Locale (may be null). @return The id with locale information appended.
[ "Adds", "locale", "information", "to", "a", "help", "module", "id", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/HelpModule.java#L68-L71
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/hash/GrantApplicationHash.java
GrantApplicationHash.computeAttachmentHash
public static String computeAttachmentHash(byte[] attachment) { byte[] rawDigest = MESSAGE_DIGESTER.digest(attachment); return Base64.encode(rawDigest); }
java
public static String computeAttachmentHash(byte[] attachment) { byte[] rawDigest = MESSAGE_DIGESTER.digest(attachment); return Base64.encode(rawDigest); }
[ "public", "static", "String", "computeAttachmentHash", "(", "byte", "[", "]", "attachment", ")", "{", "byte", "[", "]", "rawDigest", "=", "MESSAGE_DIGESTER", ".", "digest", "(", "attachment", ")", ";", "return", "Base64", ".", "encode", "(", "rawDigest", ")"...
Computes the hash of an binary attachment. @return The SHA-1 hash value of the attachment byte array.
[ "Computes", "the", "hash", "of", "an", "binary", "attachment", "." ]
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/hash/GrantApplicationHash.java#L95-L101
train
avarabyeu/jashing
jashing/src/main/java/com/github/avarabyeu/jashing/core/EventsModule.java
EventsModule.mapEventSources
@SuppressWarnings("unchecked") @VisibleForTesting Map<String, Class<? extends Service>> mapEventSources() throws IOException { /* Obtains all classpath's top level classes */ ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Set<ClassPath.ClassInfo> classes = ClassPath.from(classLoader).getAllClasses(); ClassLoaderRepository repository = new ClassLoaderRepository(classLoader); LOGGER.info("Scanning classpath for EventHandlers...."); /* iterates over all classes, filter by HandlesEvent annotation and transforms stream to needed form */ Map<String, Class<? extends Service>> collected = classes.parallelStream() /* loads class infos */ .map(classInfo -> { try { /* sometimes exception occurs during class loading. Return empty/absent in this case */ return Optional.of(repository.loadClass(classInfo.getName())); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", classInfo.getName(), e); return Optional.<JavaClass>empty(); } }) /* filters classes which is present and marked with EventSource annotation */ .filter(((Predicate<Optional<JavaClass>>) Optional::isPresent) .and(javaClassOptional -> { return Arrays.stream(javaClassOptional.get().getAnnotationEntries()).anyMatch(annotationEntry -> { return Type.getType(annotationEntry.getAnnotationType()).toString().equals(EventSource.class.getCanonicalName()); }); }) .and(javaClassOptional -> { try { return Arrays.stream(javaClassOptional.get().getAllInterfaces()).anyMatch(iface -> { return iface.getClassName().equals(Service.class.getCanonicalName()); }); } catch (ClassNotFoundException e) { LOGGER.trace("Class annotations cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return false; } })) /* transforms from Optional<JavaClass> to Class (obtaining values from Optionals) */ .map(javaClassOptional -> { try { return (Class<? extends Service>) classLoader.loadClass(javaClassOptional.get().getClassName()); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return null; } }) .filter(Objects::nonNull) .collect(Collectors.toMap(clazz -> clazz.getAnnotation(EventSource.class).value(), clazz -> clazz)); LOGGER.info("Found {} event handlers", collected.size()); return collected; }
java
@SuppressWarnings("unchecked") @VisibleForTesting Map<String, Class<? extends Service>> mapEventSources() throws IOException { /* Obtains all classpath's top level classes */ ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Set<ClassPath.ClassInfo> classes = ClassPath.from(classLoader).getAllClasses(); ClassLoaderRepository repository = new ClassLoaderRepository(classLoader); LOGGER.info("Scanning classpath for EventHandlers...."); /* iterates over all classes, filter by HandlesEvent annotation and transforms stream to needed form */ Map<String, Class<? extends Service>> collected = classes.parallelStream() /* loads class infos */ .map(classInfo -> { try { /* sometimes exception occurs during class loading. Return empty/absent in this case */ return Optional.of(repository.loadClass(classInfo.getName())); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", classInfo.getName(), e); return Optional.<JavaClass>empty(); } }) /* filters classes which is present and marked with EventSource annotation */ .filter(((Predicate<Optional<JavaClass>>) Optional::isPresent) .and(javaClassOptional -> { return Arrays.stream(javaClassOptional.get().getAnnotationEntries()).anyMatch(annotationEntry -> { return Type.getType(annotationEntry.getAnnotationType()).toString().equals(EventSource.class.getCanonicalName()); }); }) .and(javaClassOptional -> { try { return Arrays.stream(javaClassOptional.get().getAllInterfaces()).anyMatch(iface -> { return iface.getClassName().equals(Service.class.getCanonicalName()); }); } catch (ClassNotFoundException e) { LOGGER.trace("Class annotations cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return false; } })) /* transforms from Optional<JavaClass> to Class (obtaining values from Optionals) */ .map(javaClassOptional -> { try { return (Class<? extends Service>) classLoader.loadClass(javaClassOptional.get().getClassName()); } catch (ClassNotFoundException e) { LOGGER.trace("Class cannot be loaded: {}", javaClassOptional.get().getClassName(), e); return null; } }) .filter(Objects::nonNull) .collect(Collectors.toMap(clazz -> clazz.getAnnotation(EventSource.class).value(), clazz -> clazz)); LOGGER.info("Found {} event handlers", collected.size()); return collected; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "VisibleForTesting", "Map", "<", "String", ",", "Class", "<", "?", "extends", "Service", ">", ">", "mapEventSources", "(", ")", "throws", "IOException", "{", "/* Obtains all classpath's top level classes */", ...
Scans whole application classpath and finds events sources @return 'event source name' -> 'event handler class' map @throws IOException
[ "Scans", "whole", "application", "classpath", "and", "finds", "events", "sources" ]
fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8
https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/core/EventsModule.java#L124-L177
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java
JMSUtil.getClientId
public static String getClientId(Connection connection) { String clientId = null; try { clientId = connection == null ? null : connection.getClientID(); } catch (JMSException e) {} return clientId; }
java
public static String getClientId(Connection connection) { String clientId = null; try { clientId = connection == null ? null : connection.getClientID(); } catch (JMSException e) {} return clientId; }
[ "public", "static", "String", "getClientId", "(", "Connection", "connection", ")", "{", "String", "clientId", "=", "null", ";", "try", "{", "clientId", "=", "connection", "==", "null", "?", "null", ":", "connection", ".", "getClientID", "(", ")", ";", "}",...
Returns the client id from the connection. @param connection JMS connection (may be null). @return The client id (may be null).
[ "Returns", "the", "client", "id", "from", "the", "connection", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java#L80-L88
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java
JMSUtil.getMessageSelector
public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) { StringBuilder sb = new StringBuilder( "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL"); if (publisherInfo != null) { for (String selector : publisherInfo.getAttributes().values()) { addRecipientSelector(selector, sb); } } sb.append(')'); return sb.toString(); }
java
public static String getMessageSelector(String eventName, IPublisherInfo publisherInfo) { StringBuilder sb = new StringBuilder( "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL"); if (publisherInfo != null) { for (String selector : publisherInfo.getAttributes().values()) { addRecipientSelector(selector, sb); } } sb.append(')'); return sb.toString(); }
[ "public", "static", "String", "getMessageSelector", "(", "String", "eventName", ",", "IPublisherInfo", "publisherInfo", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"(JMSType='\"", "+", "eventName", "+", "\"' OR JMSType LIKE '\"", "+", "eventNa...
Creates a message selector which considers JMSType and recipients properties. @param eventName The event name (i.e. DESKTOP.LOCK). @param publisherInfo Info on the publisher. If null, then no recipients properties are added. @return The message selector.
[ "Creates", "a", "message", "selector", "which", "considers", "JMSType", "and", "recipients", "properties", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java#L97-L109
train
carewebframework/carewebframework-core
org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java
JMSUtil.addRecipientSelector
private static void addRecipientSelector(String value, StringBuilder sb) { if (value != null) { sb.append(" OR Recipients LIKE '%,").append(value).append(",%'"); } }
java
private static void addRecipientSelector(String value, StringBuilder sb) { if (value != null) { sb.append(" OR Recipients LIKE '%,").append(value).append(",%'"); } }
[ "private", "static", "void", "addRecipientSelector", "(", "String", "value", ",", "StringBuilder", "sb", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "sb", ".", "append", "(", "\" OR Recipients LIKE '%,\"", ")", ".", "append", "(", "value", ")", "...
Add a recipient selector for the given value. @param value Recipient value. @param sb String builder to receive value.
[ "Add", "a", "recipient", "selector", "for", "the", "given", "value", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.messaging-parent/org.carewebframework.messaging.jms-parent/org.carewebframework.messaging.jms.core/src/main/java/org/carewebframework/messaging/jms/JMSUtil.java#L117-L121
train
avarabyeu/jashing
jashing/src/main/java/com/github/avarabyeu/jashing/core/JashingServer.java
JashingServer.getAggregationHandler
private HttpHandler getAggregationHandler() throws ServletException { DeploymentInfo deploymentInfo = Servlets .deployment() .setClassLoader(JashingServer.class.getClassLoader()) .setContextPath("/") .setDeploymentName("jashing") .addFilterUrlMapping("wro4j", "/*", DispatcherType.REQUEST) .addFilter(Servlets.filter("wro4j", ConfigurableWroFilter.class, new InstanceFactory<ConfigurableWroFilter>() { @Override public InstanceHandle<ConfigurableWroFilter> createInstance() throws InstantiationException { ConfigurableWroFilter filter = new ConfigurableWroFilter(); filter.setWroManagerFactory(new WroManagerFactory()); return new ImmediateInstanceHandle<>(filter); } })); DeploymentManager deployment = Servlets.defaultContainer().addDeployment(deploymentInfo); deployment.deploy(); return deployment.start(); }
java
private HttpHandler getAggregationHandler() throws ServletException { DeploymentInfo deploymentInfo = Servlets .deployment() .setClassLoader(JashingServer.class.getClassLoader()) .setContextPath("/") .setDeploymentName("jashing") .addFilterUrlMapping("wro4j", "/*", DispatcherType.REQUEST) .addFilter(Servlets.filter("wro4j", ConfigurableWroFilter.class, new InstanceFactory<ConfigurableWroFilter>() { @Override public InstanceHandle<ConfigurableWroFilter> createInstance() throws InstantiationException { ConfigurableWroFilter filter = new ConfigurableWroFilter(); filter.setWroManagerFactory(new WroManagerFactory()); return new ImmediateInstanceHandle<>(filter); } })); DeploymentManager deployment = Servlets.defaultContainer().addDeployment(deploymentInfo); deployment.deploy(); return deployment.start(); }
[ "private", "HttpHandler", "getAggregationHandler", "(", ")", "throws", "ServletException", "{", "DeploymentInfo", "deploymentInfo", "=", "Servlets", ".", "deployment", "(", ")", ".", "setClassLoader", "(", "JashingServer", ".", "class", ".", "getClassLoader", "(", "...
Uses Wro4j Filter to pre-process resources Required for coffee scripts compilation and saas processing Wro4j uses Servlet API so we make fake Servlet Deployment here to emulate servlet-based environment @return Static resources handler
[ "Uses", "Wro4j", "Filter", "to", "pre", "-", "process", "resources", "Required", "for", "coffee", "scripts", "compilation", "and", "saas", "processing", "Wro4j", "uses", "Servlet", "API", "so", "we", "make", "fake", "Servlet", "Deployment", "here", "to", "emul...
fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8
https://github.com/avarabyeu/jashing/blob/fcc6ec67e2663eb1dde8cbacff5e660ca717cbc8/jashing/src/main/java/com/github/avarabyeu/jashing/core/JashingServer.java#L141-L161
train
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/library/PrepareLibs.java
PrepareLibs.loadLibFiles
public static String[] loadLibFiles(String fileSuffix, String... libAbsoluteClassPaths) { Set<String> failedDllPaths = new HashSet<String>(); for (String libAbsoluteClassPath : libAbsoluteClassPaths) { String libraryName = libAbsoluteClassPath .substring(libAbsoluteClassPath.lastIndexOf("/") + 1, libAbsoluteClassPath.lastIndexOf(fileSuffix)); try { prepareLibFile(true, libAbsoluteClassPath); System.loadLibrary(libraryName); LOGGER.info("Success load library: " + libraryName); } catch (Exception e) { LOGGER.info("Load library: " + libraryName + " failed!", e); failedDllPaths.add(libAbsoluteClassPath); } } return failedDllPaths.toArray(new String[failedDllPaths.size()]); }
java
public static String[] loadLibFiles(String fileSuffix, String... libAbsoluteClassPaths) { Set<String> failedDllPaths = new HashSet<String>(); for (String libAbsoluteClassPath : libAbsoluteClassPaths) { String libraryName = libAbsoluteClassPath .substring(libAbsoluteClassPath.lastIndexOf("/") + 1, libAbsoluteClassPath.lastIndexOf(fileSuffix)); try { prepareLibFile(true, libAbsoluteClassPath); System.loadLibrary(libraryName); LOGGER.info("Success load library: " + libraryName); } catch (Exception e) { LOGGER.info("Load library: " + libraryName + " failed!", e); failedDllPaths.add(libAbsoluteClassPath); } } return failedDllPaths.toArray(new String[failedDllPaths.size()]); }
[ "public", "static", "String", "[", "]", "loadLibFiles", "(", "String", "fileSuffix", ",", "String", "...", "libAbsoluteClassPaths", ")", "{", "Set", "<", "String", ">", "failedDllPaths", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(",...
Load libraries which placed in class path. @param fileSuffix suffix include".". eg:".dll" @param libAbsoluteClassPaths library absolute class path(start with"/"), include file name. @return library class paths that failed to load. If all success, return array size is 0.
[ "Load", "libraries", "which", "placed", "in", "class", "path", "." ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/library/PrepareLibs.java#L85-L100
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.getCardinalities
public Cardinalities getCardinalities(Class<? extends ElementBase> sourceClass) { Class<?> clazz = sourceClass; Cardinalities cardinalities = null; while (cardinalities == null && clazz != null) { cardinalities = map.get(clazz); clazz = clazz == ElementBase.class ? null : clazz.getSuperclass(); } return cardinalities; }
java
public Cardinalities getCardinalities(Class<? extends ElementBase> sourceClass) { Class<?> clazz = sourceClass; Cardinalities cardinalities = null; while (cardinalities == null && clazz != null) { cardinalities = map.get(clazz); clazz = clazz == ElementBase.class ? null : clazz.getSuperclass(); } return cardinalities; }
[ "public", "Cardinalities", "getCardinalities", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ")", "{", "Class", "<", "?", ">", "clazz", "=", "sourceClass", ";", "Cardinalities", "cardinalities", "=", "null", ";", "while", "(", "cardinal...
Returns the cardinalities associated with this class or a superclass. @param sourceClass Class whose relation is sought. @return The cardinalities, or null if none found.
[ "Returns", "the", "cardinalities", "associated", "with", "this", "class", "or", "a", "superclass", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L116-L126
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.getOrCreateCardinalities
private Cardinalities getOrCreateCardinalities(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = map.get(sourceClass); if (cardinalities == null) { map.put(sourceClass, cardinalities = new Cardinalities()); } return cardinalities; }
java
private Cardinalities getOrCreateCardinalities(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = map.get(sourceClass); if (cardinalities == null) { map.put(sourceClass, cardinalities = new Cardinalities()); } return cardinalities; }
[ "private", "Cardinalities", "getOrCreateCardinalities", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ")", "{", "Cardinalities", "cardinalities", "=", "map", ".", "get", "(", "sourceClass", ")", ";", "if", "(", "cardinalities", "==", "nul...
Returns cardinalities for the specified class, creating it if necessary. @param sourceClass Class whose cardinalities are sought. @return The cardinalities associated with the specified class (never null).
[ "Returns", "cardinalities", "for", "the", "specified", "class", "creating", "it", "if", "necessary", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L134-L142
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.addCardinality
public void addCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass, int maxOccurrences) { Cardinality cardinality = new Cardinality(sourceClass, targetClass, maxOccurrences); getOrCreateCardinalities(sourceClass).addCardinality(cardinality); }
java
public void addCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass, int maxOccurrences) { Cardinality cardinality = new Cardinality(sourceClass, targetClass, maxOccurrences); getOrCreateCardinalities(sourceClass).addCardinality(cardinality); }
[ "public", "void", "addCardinality", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "targetClass", ",", "int", "maxOccurrences", ")", "{", "Cardinality", "cardinality", "=", "new", "C...
Adds cardinality relationship between source and target classes. @param sourceClass The source class. @param targetClass Class to be registered. @param maxOccurrences Maximum occurrences for this relationship.
[ "Adds", "cardinality", "relationship", "between", "source", "and", "target", "classes", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L151-L155
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.getTotalCardinality
public int getTotalCardinality(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = getCardinalities(sourceClass); return cardinalities == null ? 0 : cardinalities.total; }
java
public int getTotalCardinality(Class<? extends ElementBase> sourceClass) { Cardinalities cardinalities = getCardinalities(sourceClass); return cardinalities == null ? 0 : cardinalities.total; }
[ "public", "int", "getTotalCardinality", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ")", "{", "Cardinalities", "cardinalities", "=", "getCardinalities", "(", "sourceClass", ")", ";", "return", "cardinalities", "==", "null", "?", "0", ":...
Returns the sum of cardinalities across all related classes. @param sourceClass The source class. @return The sum of cardinalities across all related classes.
[ "Returns", "the", "sum", "of", "cardinalities", "across", "all", "related", "classes", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L174-L177
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.isRelated
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
java
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
[ "public", "boolean", "isRelated", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "targetClass", ")", "{", "return", "getCardinality", "(", "sourceClass", ",", "targetClass", ")", "."...
Returns true if targetClass or a superclass of targetClass is related to sourceClass. @param sourceClass The primary class. @param targetClass The class to test. @return True if targetClass or a superclass of targetClass is related to sourceClass.
[ "Returns", "true", "if", "targetClass", "or", "a", "superclass", "of", "targetClass", "is", "related", "to", "sourceClass", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L186-L188
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.getCardinality
public Cardinality getCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { Cardinalities cardinalities = getCardinalities(sourceClass); Cardinality cardinality = cardinalities == null ? null : cardinalities.getCardinality(targetClass); return cardinality == null ? new Cardinality(sourceClass, targetClass, 0) : cardinality; }
java
public Cardinality getCardinality(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { Cardinalities cardinalities = getCardinalities(sourceClass); Cardinality cardinality = cardinalities == null ? null : cardinalities.getCardinality(targetClass); return cardinality == null ? new Cardinality(sourceClass, targetClass, 0) : cardinality; }
[ "public", "Cardinality", "getCardinality", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "targetClass", ")", "{", "Cardinalities", "cardinalities", "=", "getCardinalities", "(", "source...
Returns the cardinality between two element classes. @param sourceClass The primary class. @param targetClass The class to test. @return The cardinality in the class relationship (never null).
[ "Returns", "the", "cardinality", "between", "two", "element", "classes", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L197-L201
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java
AppFramework.setApplicationContext
@Override public void setApplicationContext(ApplicationContext appContext) throws BeansException { if (this.appContext != null) { throw new ApplicationContextException("Attempt to reinitialize application context."); } this.appContext = appContext; }
java
@Override public void setApplicationContext(ApplicationContext appContext) throws BeansException { if (this.appContext != null) { throw new ApplicationContextException("Attempt to reinitialize application context."); } this.appContext = appContext; }
[ "@", "Override", "public", "void", "setApplicationContext", "(", "ApplicationContext", "appContext", ")", "throws", "BeansException", "{", "if", "(", "this", ".", "appContext", "!=", "null", ")", "{", "throw", "new", "ApplicationContextException", "(", "\"Attempt to...
ApplicationContextAware interface to allow container to inject itself. Sets the active application context. @param appContext The active application context.
[ "ApplicationContextAware", "interface", "to", "allow", "container", "to", "inject", "itself", ".", "Sets", "the", "active", "application", "context", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java#L70-L77
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java
AppFramework.unregisterObject
public synchronized boolean unregisterObject(Object object) { int i = MiscUtil.indexOfInstance(registeredObjects, object); if (i > -1) { registeredObjects.remove(i); for (IRegisterEvent onRegister : onRegisterList) { onRegister.unregisterObject(object); } if (object instanceof IRegisterEvent) { onRegisterList.remove(object); } return true; } return false; }
java
public synchronized boolean unregisterObject(Object object) { int i = MiscUtil.indexOfInstance(registeredObjects, object); if (i > -1) { registeredObjects.remove(i); for (IRegisterEvent onRegister : onRegisterList) { onRegister.unregisterObject(object); } if (object instanceof IRegisterEvent) { onRegisterList.remove(object); } return true; } return false; }
[ "public", "synchronized", "boolean", "unregisterObject", "(", "Object", "object", ")", "{", "int", "i", "=", "MiscUtil", ".", "indexOfInstance", "(", "registeredObjects", ",", "object", ")", ";", "if", "(", "i", ">", "-", "1", ")", "{", "registeredObjects", ...
Remove an object registration from the framework and any relevant subsystems. @param object Object to unregister. @return True if object successfully unregistered.
[ "Remove", "an", "object", "registration", "from", "the", "framework", "and", "any", "relevant", "subsystems", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java#L148-L166
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java
AppFramework.findObject
public synchronized Object findObject(Class<?> clazz, Object previousInstance) { int i = previousInstance == null ? -1 : MiscUtil.indexOfInstance(registeredObjects, previousInstance); for (i++; i < registeredObjects.size(); i++) { Object object = registeredObjects.get(i); if (clazz.isInstance(object)) { return object; } } return null; }
java
public synchronized Object findObject(Class<?> clazz, Object previousInstance) { int i = previousInstance == null ? -1 : MiscUtil.indexOfInstance(registeredObjects, previousInstance); for (i++; i < registeredObjects.size(); i++) { Object object = registeredObjects.get(i); if (clazz.isInstance(object)) { return object; } } return null; }
[ "public", "synchronized", "Object", "findObject", "(", "Class", "<", "?", ">", "clazz", ",", "Object", "previousInstance", ")", "{", "int", "i", "=", "previousInstance", "==", "null", "?", "-", "1", ":", "MiscUtil", ".", "indexOfInstance", "(", "registeredOb...
Finds a registered object belonging to the specified class. @param clazz Returned object must be assignment-compatible with this class. @param previousInstance Previous instance returned by this call. Search will start with the entry that follows this one in the list. If this parameter is null, the search starts at the beginning. @return Reference to the discovered object or null if none found.
[ "Finds", "a", "registered", "object", "belonging", "to", "the", "specified", "class", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java#L177-L189
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java
AppFramework.postProcessAfterInitialization
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { registerObject(bean); return bean; }
java
@Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { registerObject(bean); return bean; }
[ "@", "Override", "public", "Object", "postProcessAfterInitialization", "(", "Object", "bean", ",", "String", "beanName", ")", "throws", "BeansException", "{", "registerObject", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Automatically registers any container-managed bean with the framework. @param bean Object to register. @param beanName Name of the managed bean.
[ "Automatically", "registers", "any", "container", "-", "managed", "bean", "with", "the", "framework", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/AppFramework.java#L197-L201
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java
ElementLayout.afterInitialize
@Override public void afterInitialize(boolean deserializing) throws Exception { super.afterInitialize(deserializing); if (linked) { internalDeserialize(false); } initializing = false; }
java
@Override public void afterInitialize(boolean deserializing) throws Exception { super.afterInitialize(deserializing); if (linked) { internalDeserialize(false); } initializing = false; }
[ "@", "Override", "public", "void", "afterInitialize", "(", "boolean", "deserializing", ")", "throws", "Exception", "{", "super", ".", "afterInitialize", "(", "deserializing", ")", ";", "if", "(", "linked", ")", "{", "internalDeserialize", "(", "false", ")", ";...
If this is a linked layout, must deserialize from it.
[ "If", "this", "is", "a", "linked", "layout", "must", "deserialize", "from", "it", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java#L145-L154
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java
ElementLayout.internalDeserialize
private void internalDeserialize(boolean forced) { if (!forced && loaded) { return; } lockDescendants(false); removeChildren(); loaded = true; try { if (linked) { checkForCircularReference(); } getLayout().materialize(this); if (linked) { lockDescendants(true); } } catch (Exception e) { CWFException.raise("Error loading layout.", e); } }
java
private void internalDeserialize(boolean forced) { if (!forced && loaded) { return; } lockDescendants(false); removeChildren(); loaded = true; try { if (linked) { checkForCircularReference(); } getLayout().materialize(this); if (linked) { lockDescendants(true); } } catch (Exception e) { CWFException.raise("Error loading layout.", e); } }
[ "private", "void", "internalDeserialize", "(", "boolean", "forced", ")", "{", "if", "(", "!", "forced", "&&", "loaded", ")", "{", "return", ";", "}", "lockDescendants", "(", "false", ")", ";", "removeChildren", "(", ")", ";", "loaded", "=", "true", ";", ...
Deserialize from the associated layout. @param forced If true, force deserialization regardless of load state.
[ "Deserialize", "from", "the", "associated", "layout", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java#L169-L191
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java
ElementLayout.checkForCircularReference
private void checkForCircularReference() { ElementLayout layout = this; while ((layout = layout.getAncestor(ElementLayout.class)) != null) { if (layout.linked && layout.shared == shared && layout.layoutName.equals(layoutName)) { CWFException.raise("Circular reference to layout " + layoutName); } } }
java
private void checkForCircularReference() { ElementLayout layout = this; while ((layout = layout.getAncestor(ElementLayout.class)) != null) { if (layout.linked && layout.shared == shared && layout.layoutName.equals(layoutName)) { CWFException.raise("Circular reference to layout " + layoutName); } } }
[ "private", "void", "checkForCircularReference", "(", ")", "{", "ElementLayout", "layout", "=", "this", ";", "while", "(", "(", "layout", "=", "layout", ".", "getAncestor", "(", "ElementLayout", ".", "class", ")", ")", "!=", "null", ")", "{", "if", "(", "...
Checks for a circular reference to the same linked layout, throwing an exception if found.
[ "Checks", "for", "a", "circular", "reference", "to", "the", "same", "linked", "layout", "throwing", "an", "exception", "if", "found", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java#L196-L204
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java
ElementLayout.lockDescendants
private void lockDescendants(Iterable<ElementBase> children, boolean lock) { for (ElementBase child : children) { child.setLocked(lock); lockDescendants(child.getChildren(), lock); } }
java
private void lockDescendants(Iterable<ElementBase> children, boolean lock) { for (ElementBase child : children) { child.setLocked(lock); lockDescendants(child.getChildren(), lock); } }
[ "private", "void", "lockDescendants", "(", "Iterable", "<", "ElementBase", ">", "children", ",", "boolean", "lock", ")", "{", "for", "(", "ElementBase", "child", ":", "children", ")", "{", "child", ".", "setLocked", "(", "lock", ")", ";", "lockDescendants", ...
Sets the lock state for all descendants of this layout. @param children List of descendants. @param lock The lock state.
[ "Sets", "the", "lock", "state", "for", "all", "descendants", "of", "this", "layout", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java#L221-L226
train
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java
ElementLayout.setLinked
public void setLinked(boolean linked) { if (linked != this.linked) { this.linked = linked; if (!initializing) { internalDeserialize(true); getRoot().activate(true); } } }
java
public void setLinked(boolean linked) { if (linked != this.linked) { this.linked = linked; if (!initializing) { internalDeserialize(true); getRoot().activate(true); } } }
[ "public", "void", "setLinked", "(", "boolean", "linked", ")", "{", "if", "(", "linked", "!=", "this", ".", "linked", ")", "{", "this", ".", "linked", "=", "linked", ";", "if", "(", "!", "initializing", ")", "{", "internalDeserialize", "(", "true", ")",...
Sets the linked state. A change in this state requires reloading of the associated layout. @param linked The linked state.
[ "Sets", "the", "linked", "state", ".", "A", "change", "in", "this", "state", "requires", "reloading", "of", "the", "associated", "layout", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementLayout.java#L246-L255
train
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.getSelfConfigDecimal
public static BigDecimal getSelfConfigDecimal(String configAbsoluteClassPath, IConfigKey key) { OneProperties configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { addSelfConfigs(configAbsoluteClassPath, null); configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { return VOID_CONFIGS.getDecimalConfig(key); } } return configs.getDecimalConfig(key); }
java
public static BigDecimal getSelfConfigDecimal(String configAbsoluteClassPath, IConfigKey key) { OneProperties configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { addSelfConfigs(configAbsoluteClassPath, null); configs = otherConfigs.get(configAbsoluteClassPath); if (configs == null) { return VOID_CONFIGS.getDecimalConfig(key); } } return configs.getDecimalConfig(key); }
[ "public", "static", "BigDecimal", "getSelfConfigDecimal", "(", "String", "configAbsoluteClassPath", ",", "IConfigKey", "key", ")", "{", "OneProperties", "configs", "=", "otherConfigs", ".", "get", "(", "configAbsoluteClassPath", ")", ";", "if", "(", "configs", "==",...
Get self config decimal. @param configAbsoluteClassPath config path. @param key config key in configAbsoluteClassPath config file @return config BigDecimal value. Return null if not add config file or not config in config file. @see #addSelfConfigs(String, OneProperties)
[ "Get", "self", "config", "decimal", "." ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L293-L303
train
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.isHavePathSelfConfig
public static boolean isHavePathSelfConfig(IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return isSelfConfig(configAbsoluteClassPath, key); }
java
public static boolean isHavePathSelfConfig(IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return isSelfConfig(configAbsoluteClassPath, key); }
[ "public", "static", "boolean", "isHavePathSelfConfig", "(", "IConfigKeyWithPath", "key", ")", "{", "String", "configAbsoluteClassPath", "=", "key", ".", "getConfigPath", "(", ")", ";", "return", "isSelfConfig", "(", "configAbsoluteClassPath", ",", "key", ")", ";", ...
Get self config boolean value @param key config key with configAbsoluteClassPath in config file @return true/false. If not add config file or not config in config file, return false. @see #addSelfConfigs(String, OneProperties)
[ "Get", "self", "config", "boolean", "value" ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L365-L368
train
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.modifySystemConfig
public static void modifySystemConfig(IConfigKey key, String value) throws IOException { systemConfigs.modifyConfig(key, value); }
java
public static void modifySystemConfig(IConfigKey key, String value) throws IOException { systemConfigs.modifyConfig(key, value); }
[ "public", "static", "void", "modifySystemConfig", "(", "IConfigKey", "key", ",", "String", "value", ")", "throws", "IOException", "{", "systemConfigs", ".", "modifyConfig", "(", "key", ",", "value", ")", ";", "}" ]
Modify one system config. @param key need update config's key @param value new config value @throws IOException
[ "Modify", "one", "system", "config", "." ]
4f2bf3f36df10195a978f122ed682ba1eb0462b5
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L433-L435
train
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventManager.java
EventManager.hostSubscribe
private void hostSubscribe(String eventName, boolean subscribe) { if (globalEventDispatcher != null) { try { globalEventDispatcher.subscribeRemoteEvent(eventName, subscribe); } catch (Throwable e) { log.error( "Error " + (subscribe ? "subscribing to" : "unsubscribing from") + " remote event '" + eventName + "'", e); } } }
java
private void hostSubscribe(String eventName, boolean subscribe) { if (globalEventDispatcher != null) { try { globalEventDispatcher.subscribeRemoteEvent(eventName, subscribe); } catch (Throwable e) { log.error( "Error " + (subscribe ? "subscribing to" : "unsubscribing from") + " remote event '" + eventName + "'", e); } } }
[ "private", "void", "hostSubscribe", "(", "String", "eventName", ",", "boolean", "subscribe", ")", "{", "if", "(", "globalEventDispatcher", "!=", "null", ")", "{", "try", "{", "globalEventDispatcher", ".", "subscribeRemoteEvent", "(", "eventName", ",", "subscribe",...
Registers or unregisters a subscription with the global event dispatcher, if one is present. @param eventName Name of event @param subscribe If true, a subscription is registered. If false, it is unregistered.
[ "Registers", "or", "unregisters", "a", "subscription", "with", "the", "global", "event", "dispatcher", "if", "one", "is", "present", "." ]
fa3252d4f7541dbe151b92c3d4f6f91433cd1673
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/event/EventManager.java#L144-L154
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java
AbstractQueueFactory.setDefaultObserver
public AbstractQueueFactory<T, ID, DATA> setDefaultObserver( IQueueObserver<ID, DATA> defaultObserver) { this.defaultObserver = defaultObserver; return this; }
java
public AbstractQueueFactory<T, ID, DATA> setDefaultObserver( IQueueObserver<ID, DATA> defaultObserver) { this.defaultObserver = defaultObserver; return this; }
[ "public", "AbstractQueueFactory", "<", "T", ",", "ID", ",", "DATA", ">", "setDefaultObserver", "(", "IQueueObserver", "<", "ID", ",", "DATA", ">", "defaultObserver", ")", "{", "this", ".", "defaultObserver", "=", "defaultObserver", ";", "return", "this", ";", ...
Set default queue's event observer. @param defaultObserver @return @since 0.6.0
[ "Set", "default", "queue", "s", "event", "observer", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java#L127-L131
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java
AbstractQueueFactory.initQueue
protected void initQueue(T queue, QueueSpec spec) throws Exception { queue.setObserver(defaultObserver); queue.init(); }
java
protected void initQueue(T queue, QueueSpec spec) throws Exception { queue.setObserver(defaultObserver); queue.init(); }
[ "protected", "void", "initQueue", "(", "T", "queue", ",", "QueueSpec", "spec", ")", "throws", "Exception", "{", "queue", ".", "setObserver", "(", "defaultObserver", ")", ";", "queue", ".", "init", "(", ")", ";", "}" ]
Initializes a newly created queue instance. <p> Called by {@link #createAndInitQueue(QueueSpec)}. Sub-class may override this method to implement its own business logic. </p> @param queue @param spec
[ "Initializes", "a", "newly", "created", "queue", "instance", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java#L169-L172
train
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java
AbstractQueueFactory.createAndInitQueue
protected T createAndInitQueue(QueueSpec spec) throws Exception { T queue = createQueueInstance(spec); queue.setQueueName(spec.name); initQueue(queue, spec); return queue; }
java
protected T createAndInitQueue(QueueSpec spec) throws Exception { T queue = createQueueInstance(spec); queue.setQueueName(spec.name); initQueue(queue, spec); return queue; }
[ "protected", "T", "createAndInitQueue", "(", "QueueSpec", "spec", ")", "throws", "Exception", "{", "T", "queue", "=", "createQueueInstance", "(", "spec", ")", ";", "queue", ".", "setQueueName", "(", "spec", ".", "name", ")", ";", "initQueue", "(", "queue", ...
Creates & Initializes a new queue instance. @param spec @return @throws Exception
[ "Creates", "&", "Initializes", "a", "new", "queue", "instance", "." ]
b20776850d23111d3d71fc8ed6023c590bc3621f
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/AbstractQueueFactory.java#L181-L186
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetV1_0Generator.java
RRBudgetV1_0Generator.getBudgetYear1DataType
private BudgetYear1DataType getBudgetYear1DataType( BudgetPeriodDto periodInfo) { BudgetYear1DataType budgetYear = BudgetYear1DataType.Factory .newInstance(); budgetYear.setBudgetPeriodStartDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getStartDate())); budgetYear.setBudgetPeriodEndDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getEndDate())); BudgetPeriod.Enum budgetPeriod = BudgetPeriod.Enum.forInt(periodInfo .getBudgetPeriod()); budgetYear.setBudgetPeriod(budgetPeriod); budgetYear.setKeyPersons(getKeyPersons(periodInfo)); budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo)); if (periodInfo.getTotalCompensation() != null) { budgetYear.setTotalCompensation(periodInfo.getTotalCompensation() .bigDecimalValue()); } budgetYear.setEquipment(getEquipment(periodInfo)); budgetYear.setTravel(getTravel(periodInfo)); budgetYear .setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo)); budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo)); budgetYear.setDirectCosts(periodInfo.getDirectCostsTotal() .bigDecimalValue()); IndirectCosts indirectCosts = getIndirectCosts(periodInfo); if (indirectCosts != null) { budgetYear.setIndirectCosts(indirectCosts); budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts())); }else{ budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue()); } budgetYear .setCognizantFederalAgency(periodInfo.getCognizantFedAgency()); AttachedFileDataType attachedFileDataType = null; for (NarrativeContract narrative : pdDoc.getDevelopmentProposal() .getNarratives()) { if (narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == BUDGET_JUSTIFICATION_ATTACHMENT) { attachedFileDataType = getAttachedFileType(narrative); if(attachedFileDataType != null){ budgetYear.setBudgetJustificationAttachment(attachedFileDataType); break; } } } return budgetYear; }
java
private BudgetYear1DataType getBudgetYear1DataType( BudgetPeriodDto periodInfo) { BudgetYear1DataType budgetYear = BudgetYear1DataType.Factory .newInstance(); budgetYear.setBudgetPeriodStartDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getStartDate())); budgetYear.setBudgetPeriodEndDate(s2SDateTimeService .convertDateToCalendar(periodInfo.getEndDate())); BudgetPeriod.Enum budgetPeriod = BudgetPeriod.Enum.forInt(periodInfo .getBudgetPeriod()); budgetYear.setBudgetPeriod(budgetPeriod); budgetYear.setKeyPersons(getKeyPersons(periodInfo)); budgetYear.setOtherPersonnel(getOtherPersonnel(periodInfo)); if (periodInfo.getTotalCompensation() != null) { budgetYear.setTotalCompensation(periodInfo.getTotalCompensation() .bigDecimalValue()); } budgetYear.setEquipment(getEquipment(periodInfo)); budgetYear.setTravel(getTravel(periodInfo)); budgetYear .setParticipantTraineeSupportCosts(getParticipantTraineeSupportCosts(periodInfo)); budgetYear.setOtherDirectCosts(getOtherDirectCosts(periodInfo)); budgetYear.setDirectCosts(periodInfo.getDirectCostsTotal() .bigDecimalValue()); IndirectCosts indirectCosts = getIndirectCosts(periodInfo); if (indirectCosts != null) { budgetYear.setIndirectCosts(indirectCosts); budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue().add(indirectCosts.getTotalIndirectCosts())); }else{ budgetYear.setTotalCosts(periodInfo.getDirectCostsTotal().bigDecimalValue()); } budgetYear .setCognizantFederalAgency(periodInfo.getCognizantFedAgency()); AttachedFileDataType attachedFileDataType = null; for (NarrativeContract narrative : pdDoc.getDevelopmentProposal() .getNarratives()) { if (narrative.getNarrativeType().getCode() != null && Integer.parseInt(narrative.getNarrativeType().getCode()) == BUDGET_JUSTIFICATION_ATTACHMENT) { attachedFileDataType = getAttachedFileType(narrative); if(attachedFileDataType != null){ budgetYear.setBudgetJustificationAttachment(attachedFileDataType); break; } } } return budgetYear; }
[ "private", "BudgetYear1DataType", "getBudgetYear1DataType", "(", "BudgetPeriodDto", "periodInfo", ")", "{", "BudgetYear1DataType", "budgetYear", "=", "BudgetYear1DataType", ".", "Factory", ".", "newInstance", "(", ")", ";", "budgetYear", ".", "setBudgetPeriodStartDate", "...
This method gets BudgetYear1DataType details like BudgetPeriodStartDate,BudgetPeriodEndDate,BudgetPeriod KeyPersons,OtherPersonnel,TotalCompensation,Equipment,ParticipantTraineeSupportCosts,Travel,OtherDirectCosts DirectCosts,IndirectCosts,CognizantFederalAgency,TotalCosts and BudgetJustificationAttachment based on BudgetPeriodInfo for the RRBudget. @param periodInfo (BudgetPeriodInfo) budget period entry. @return BudgetYear1DataType corresponding to the BudgetPeriodInfo entry.
[ "This", "method", "gets", "BudgetYear1DataType", "details", "like", "BudgetPeriodStartDate", "BudgetPeriodEndDate", "BudgetPeriod", "KeyPersons", "OtherPersonnel", "TotalCompensation", "Equipment", "ParticipantTraineeSupportCosts", "Travel", "OtherDirectCosts", "DirectCosts", "Indi...
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetV1_0Generator.java#L161-L209
train
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetV1_0Generator.java
RRBudgetV1_0Generator.getBudgetSummary
private BudgetSummary getBudgetSummary(BudgetSummaryDto budgetSummaryData) { BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance(); // Set default values for mandatory fields budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedPersonnel(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(BigDecimal.ZERO); if (budgetSummaryData != null) { if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(budgetSummaryData .getCumTotalFundsForSrPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedOtherPersonnel(budgetSummaryData .getCumTotalFundsForOtherPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumNumOtherPersonnel() != null) { budgetSummary .setCumulativeTotalNoOtherPersonnel(budgetSummaryData .getCumNumOtherPersonnel().intValue()); } if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedPersonnel(budgetSummaryData .getCumTotalFundsForPersonnel() .bigDecimalValue()); } budgetSummary .setCumulativeEquipments(getCumulativeEquipments(budgetSummaryData)); budgetSummary .setCumulativeTravels(getCumulativeTravels(budgetSummaryData)); budgetSummary .setCumulativeTrainee(getCumulativeTrainee(budgetSummaryData)); budgetSummary .setCumulativeOtherDirect(getCumulativeOtherDirect(budgetSummaryData)); if (budgetSummaryData.getCumTotalDirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(budgetSummaryData .getCumTotalDirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalIndirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedIndirectCost(budgetSummaryData .getCumTotalIndirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectIndirectCosts(budgetSummaryData .getCumTotalCosts().bigDecimalValue()); } if (budgetSummaryData.getCumFee() != null) { budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee() .bigDecimalValue()); } } return budgetSummary; }
java
private BudgetSummary getBudgetSummary(BudgetSummaryDto budgetSummaryData) { BudgetSummary budgetSummary = BudgetSummary.Factory.newInstance(); // Set default values for mandatory fields budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedPersonnel(BigDecimal.ZERO); budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(BigDecimal.ZERO); if (budgetSummaryData != null) { if (budgetSummaryData.getCumTotalFundsForSrPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedSeniorKeyPerson(budgetSummaryData .getCumTotalFundsForSrPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumTotalFundsForOtherPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedOtherPersonnel(budgetSummaryData .getCumTotalFundsForOtherPersonnel() .bigDecimalValue()); } if (budgetSummaryData.getCumNumOtherPersonnel() != null) { budgetSummary .setCumulativeTotalNoOtherPersonnel(budgetSummaryData .getCumNumOtherPersonnel().intValue()); } if (budgetSummaryData.getCumTotalFundsForPersonnel() != null) { budgetSummary .setCumulativeTotalFundsRequestedPersonnel(budgetSummaryData .getCumTotalFundsForPersonnel() .bigDecimalValue()); } budgetSummary .setCumulativeEquipments(getCumulativeEquipments(budgetSummaryData)); budgetSummary .setCumulativeTravels(getCumulativeTravels(budgetSummaryData)); budgetSummary .setCumulativeTrainee(getCumulativeTrainee(budgetSummaryData)); budgetSummary .setCumulativeOtherDirect(getCumulativeOtherDirect(budgetSummaryData)); if (budgetSummaryData.getCumTotalDirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectCosts(budgetSummaryData .getCumTotalDirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalIndirectCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedIndirectCost(budgetSummaryData .getCumTotalIndirectCosts().bigDecimalValue()); } if (budgetSummaryData.getCumTotalCosts() != null) { budgetSummary .setCumulativeTotalFundsRequestedDirectIndirectCosts(budgetSummaryData .getCumTotalCosts().bigDecimalValue()); } if (budgetSummaryData.getCumFee() != null) { budgetSummary.setCumulativeFee(budgetSummaryData.getCumFee() .bigDecimalValue()); } } return budgetSummary; }
[ "private", "BudgetSummary", "getBudgetSummary", "(", "BudgetSummaryDto", "budgetSummaryData", ")", "{", "BudgetSummary", "budgetSummary", "=", "BudgetSummary", ".", "Factory", ".", "newInstance", "(", ")", ";", "// Set default values for mandatory fields", "budgetSummary", ...
This method gets BudgetSummary details such as CumulativeTotalFundsRequestedSeniorKeyPerson,CumulativeTotalFundsRequestedOtherPersonnel CumulativeTotalNoOtherPersonnel,CumulativeTotalFundsRequestedPersonnel,CumulativeEquipments,CumulativeTravels CumulativeTrainee,CumulativeOtherDirect,CumulativeTotalFundsRequestedDirectCosts,CumulativeTotalFundsRequestedIndirectCost CumulativeTotalFundsRequestedDirectIndirectCosts and CumulativeFee based on BudgetSummaryInfo for the RRBudget. @param budgetSummaryData (BudgetSummaryInfo) budget summary info entry. @return BudgetSummary details corresponding to the BudgetSummaryInfo object.
[ "This", "method", "gets", "BudgetSummary", "details", "such", "as", "CumulativeTotalFundsRequestedSeniorKeyPerson", "CumulativeTotalFundsRequestedOtherPersonnel", "CumulativeTotalNoOtherPersonnel", "CumulativeTotalFundsRequestedPersonnel", "CumulativeEquipments", "CumulativeTravels", "Cumu...
2886380e1e3cb8bdd732ba99b2afa6ffc630bb37
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudgetV1_0Generator.java#L282-L346
train