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
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getObjectReferenceDescriptorByName
public ObjectReferenceDescriptor getObjectReferenceDescriptorByName(String name) { ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) getObjectReferenceDescriptorsNameMap().get(name); // // BRJ: if the ReferenceDescriptor is not found // look in the ClassDescriptor referenced by 'super' for it // if (ord == null) { ClassDescriptor superCld = getSuperClassDescriptor(); if (superCld != null) { ord = superCld.getObjectReferenceDescriptorByName(name); } } return ord; }
java
public ObjectReferenceDescriptor getObjectReferenceDescriptorByName(String name) { ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) getObjectReferenceDescriptorsNameMap().get(name); // // BRJ: if the ReferenceDescriptor is not found // look in the ClassDescriptor referenced by 'super' for it // if (ord == null) { ClassDescriptor superCld = getSuperClassDescriptor(); if (superCld != null) { ord = superCld.getObjectReferenceDescriptorByName(name); } } return ord; }
[ "public", "ObjectReferenceDescriptor", "getObjectReferenceDescriptorByName", "(", "String", "name", ")", "{", "ObjectReferenceDescriptor", "ord", "=", "(", "ObjectReferenceDescriptor", ")", "getObjectReferenceDescriptorsNameMap", "(", ")", ".", "get", "(", "name", ")", ";", "//\r", "// BRJ: if the ReferenceDescriptor is not found\r", "// look in the ClassDescriptor referenced by 'super' for it\r", "//\r", "if", "(", "ord", "==", "null", ")", "{", "ClassDescriptor", "superCld", "=", "getSuperClassDescriptor", "(", ")", ";", "if", "(", "superCld", "!=", "null", ")", "{", "ord", "=", "superCld", ".", "getObjectReferenceDescriptorByName", "(", "name", ")", ";", "}", "}", "return", "ord", ";", "}" ]
Get an ObjectReferenceDescriptor by name BRJ @param name @return ObjectReferenceDescriptor or null
[ "Get", "an", "ObjectReferenceDescriptor", "by", "name", "BRJ" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L511-L529
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getCollectionDescriptorByName
public CollectionDescriptor getCollectionDescriptorByName(String name) { if (name == null) { return null; } CollectionDescriptor cod = (CollectionDescriptor) getCollectionDescriptorNameMap().get(name); // // BRJ: if the CollectionDescriptor is not found // look in the ClassDescriptor referenced by 'super' for it // if (cod == null) { ClassDescriptor superCld = getSuperClassDescriptor(); if (superCld != null) { cod = superCld.getCollectionDescriptorByName(name); } } return cod; }
java
public CollectionDescriptor getCollectionDescriptorByName(String name) { if (name == null) { return null; } CollectionDescriptor cod = (CollectionDescriptor) getCollectionDescriptorNameMap().get(name); // // BRJ: if the CollectionDescriptor is not found // look in the ClassDescriptor referenced by 'super' for it // if (cod == null) { ClassDescriptor superCld = getSuperClassDescriptor(); if (superCld != null) { cod = superCld.getCollectionDescriptorByName(name); } } return cod; }
[ "public", "CollectionDescriptor", "getCollectionDescriptorByName", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "CollectionDescriptor", "cod", "=", "(", "CollectionDescriptor", ")", "getCollectionDescriptorNameMap", "(", ")", ".", "get", "(", "name", ")", ";", "//\r", "// BRJ: if the CollectionDescriptor is not found\r", "// look in the ClassDescriptor referenced by 'super' for it\r", "//\r", "if", "(", "cod", "==", "null", ")", "{", "ClassDescriptor", "superCld", "=", "getSuperClassDescriptor", "(", ")", ";", "if", "(", "superCld", "!=", "null", ")", "{", "cod", "=", "superCld", ".", "getCollectionDescriptorByName", "(", "name", ")", ";", "}", "}", "return", "cod", ";", "}" ]
Get an CollectionDescriptor by name BRJ @param name @return CollectionDescriptor or null
[ "Get", "an", "CollectionDescriptor", "by", "name", "BRJ" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L554-L577
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getSuperClassDescriptor
public ClassDescriptor getSuperClassDescriptor() { if (!m_superCldSet) { if(getBaseClass() != null) { m_superCld = getRepository().getDescriptorFor(getBaseClass()); if(m_superCld.isAbstract() || m_superCld.isInterface()) { throw new MetadataException("Super class mapping only work for real class, but declared super class" + " is an interface or is abstract. Declared class: " + m_superCld.getClassNameOfObject()); } } m_superCldSet = true; } return m_superCld; }
java
public ClassDescriptor getSuperClassDescriptor() { if (!m_superCldSet) { if(getBaseClass() != null) { m_superCld = getRepository().getDescriptorFor(getBaseClass()); if(m_superCld.isAbstract() || m_superCld.isInterface()) { throw new MetadataException("Super class mapping only work for real class, but declared super class" + " is an interface or is abstract. Declared class: " + m_superCld.getClassNameOfObject()); } } m_superCldSet = true; } return m_superCld; }
[ "public", "ClassDescriptor", "getSuperClassDescriptor", "(", ")", "{", "if", "(", "!", "m_superCldSet", ")", "{", "if", "(", "getBaseClass", "(", ")", "!=", "null", ")", "{", "m_superCld", "=", "getRepository", "(", ")", ".", "getDescriptorFor", "(", "getBaseClass", "(", ")", ")", ";", "if", "(", "m_superCld", ".", "isAbstract", "(", ")", "||", "m_superCld", ".", "isInterface", "(", ")", ")", "{", "throw", "new", "MetadataException", "(", "\"Super class mapping only work for real class, but declared super class\"", "+", "\" is an interface or is abstract. Declared class: \"", "+", "m_superCld", ".", "getClassNameOfObject", "(", ")", ")", ";", "}", "}", "m_superCldSet", "=", "true", ";", "}", "return", "m_superCld", ";", "}" ]
Answers the ClassDescriptor referenced by 'super' ReferenceDescriptor. @return ClassDescriptor or null
[ "Answers", "the", "ClassDescriptor", "referenced", "by", "super", "ReferenceDescriptor", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L601-L618
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.addExtentClass
public void addExtentClass(String newExtentClassName) { extentClassNames.add(newExtentClassName); if(m_repository != null) m_repository.addExtent(newExtentClassName, this); }
java
public void addExtentClass(String newExtentClassName) { extentClassNames.add(newExtentClassName); if(m_repository != null) m_repository.addExtent(newExtentClassName, this); }
[ "public", "void", "addExtentClass", "(", "String", "newExtentClassName", ")", "{", "extentClassNames", ".", "add", "(", "newExtentClassName", ")", ";", "if", "(", "m_repository", "!=", "null", ")", "m_repository", ".", "addExtent", "(", "newExtentClassName", ",", "this", ")", ";", "}" ]
add an Extent class to the current descriptor @param newExtentClassName name of the class to add
[ "add", "an", "Extent", "class", "to", "the", "current", "descriptor" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L644-L648
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.setProxyClass
public void setProxyClass(Class newProxyClass) { proxyClass = newProxyClass; if (proxyClass == null) { setProxyClassName(null); } else { proxyClassName = proxyClass.getName(); } }
java
public void setProxyClass(Class newProxyClass) { proxyClass = newProxyClass; if (proxyClass == null) { setProxyClassName(null); } else { proxyClassName = proxyClass.getName(); } }
[ "public", "void", "setProxyClass", "(", "Class", "newProxyClass", ")", "{", "proxyClass", "=", "newProxyClass", ";", "if", "(", "proxyClass", "==", "null", ")", "{", "setProxyClassName", "(", "null", ")", ";", "}", "else", "{", "proxyClassName", "=", "proxyClass", ".", "getName", "(", ")", ";", "}", "}" ]
Sets the proxy class to be used. @param newProxyClass java.lang.Class
[ "Sets", "the", "proxy", "class", "to", "be", "used", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L751-L762
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getAutoIncrementField
public FieldDescriptor getAutoIncrementField() { if (m_autoIncrementField == null) { FieldDescriptor[] fds = getPkFields(); for (int i = 0; i < fds.length; i++) { FieldDescriptor fd = fds[i]; if (fd.isAutoIncrement()) { m_autoIncrementField = fd; break; } } } if (m_autoIncrementField == null) { LoggerFactory.getDefaultLogger().warn( this.getClass().getName() + ": " + "Could not find autoincrement attribute for class: " + this.getClassNameOfObject()); } return m_autoIncrementField; }
java
public FieldDescriptor getAutoIncrementField() { if (m_autoIncrementField == null) { FieldDescriptor[] fds = getPkFields(); for (int i = 0; i < fds.length; i++) { FieldDescriptor fd = fds[i]; if (fd.isAutoIncrement()) { m_autoIncrementField = fd; break; } } } if (m_autoIncrementField == null) { LoggerFactory.getDefaultLogger().warn( this.getClass().getName() + ": " + "Could not find autoincrement attribute for class: " + this.getClassNameOfObject()); } return m_autoIncrementField; }
[ "public", "FieldDescriptor", "getAutoIncrementField", "(", ")", "{", "if", "(", "m_autoIncrementField", "==", "null", ")", "{", "FieldDescriptor", "[", "]", "fds", "=", "getPkFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fds", ".", "length", ";", "i", "++", ")", "{", "FieldDescriptor", "fd", "=", "fds", "[", "i", "]", ";", "if", "(", "fd", ".", "isAutoIncrement", "(", ")", ")", "{", "m_autoIncrementField", "=", "fd", ";", "break", ";", "}", "}", "}", "if", "(", "m_autoIncrementField", "==", "null", ")", "{", "LoggerFactory", ".", "getDefaultLogger", "(", ")", ".", "warn", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\": \"", "+", "\"Could not find autoincrement attribute for class: \"", "+", "this", ".", "getClassNameOfObject", "(", ")", ")", ";", "}", "return", "m_autoIncrementField", ";", "}" ]
Returns the first found autoincrement field defined in this class descriptor. Use carefully when multiple autoincrement field were defined. @deprecated does not make sense because it's possible to define more than one autoincrement field. Alternative see {@link #getAutoIncrementFields}
[ "Returns", "the", "first", "found", "autoincrement", "field", "defined", "in", "this", "class", "descriptor", ".", "Use", "carefully", "when", "multiple", "autoincrement", "field", "were", "defined", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L908-L933
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getCurrentLockingValues
public ValueContainer[] getCurrentLockingValues(Object o) throws PersistenceBrokerException { FieldDescriptor[] fields = getLockingFields(); ValueContainer[] result = new ValueContainer[fields.length]; for (int i = 0; i < result.length; i++) { result[i] = new ValueContainer(fields[i].getPersistentField().get(o), fields[i].getJdbcType()); } return result; }
java
public ValueContainer[] getCurrentLockingValues(Object o) throws PersistenceBrokerException { FieldDescriptor[] fields = getLockingFields(); ValueContainer[] result = new ValueContainer[fields.length]; for (int i = 0; i < result.length; i++) { result[i] = new ValueContainer(fields[i].getPersistentField().get(o), fields[i].getJdbcType()); } return result; }
[ "public", "ValueContainer", "[", "]", "getCurrentLockingValues", "(", "Object", "o", ")", "throws", "PersistenceBrokerException", "{", "FieldDescriptor", "[", "]", "fields", "=", "getLockingFields", "(", ")", ";", "ValueContainer", "[", "]", "result", "=", "new", "ValueContainer", "[", "fields", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "new", "ValueContainer", "(", "fields", "[", "i", "]", ".", "getPersistentField", "(", ")", ".", "get", "(", "o", ")", ",", "fields", "[", "i", "]", ".", "getJdbcType", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
returns an Array with an Objects CURRENT locking VALUES , BRJ @throws PersistenceBrokerException if there is an erros accessing o field values
[ "returns", "an", "Array", "with", "an", "Objects", "CURRENT", "locking", "VALUES", "BRJ" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L950-L959
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.updateLockingValues
public void updateLockingValues(Object obj) throws PersistenceBrokerException { FieldDescriptor[] fields = getLockingFields(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fmd = fields[i]; if (fmd.isUpdateLock()) { PersistentField f = fmd.getPersistentField(); Object cv = f.get(obj); // int if ((f.getType() == int.class) || (f.getType() == Integer.class)) { int newCv = 0; if (cv != null) { newCv = ((Number) cv).intValue(); } newCv++; f.set(obj, new Integer(newCv)); } // long else if ((f.getType() == long.class) || (f.getType() == Long.class)) { long newCv = 0; if (cv != null) { newCv = ((Number) cv).longValue(); } newCv++; f.set(obj, new Long(newCv)); } // Timestamp else if (f.getType() == Timestamp.class) { long newCv = System.currentTimeMillis(); f.set(obj, new Timestamp(newCv)); } } } }
java
public void updateLockingValues(Object obj) throws PersistenceBrokerException { FieldDescriptor[] fields = getLockingFields(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fmd = fields[i]; if (fmd.isUpdateLock()) { PersistentField f = fmd.getPersistentField(); Object cv = f.get(obj); // int if ((f.getType() == int.class) || (f.getType() == Integer.class)) { int newCv = 0; if (cv != null) { newCv = ((Number) cv).intValue(); } newCv++; f.set(obj, new Integer(newCv)); } // long else if ((f.getType() == long.class) || (f.getType() == Long.class)) { long newCv = 0; if (cv != null) { newCv = ((Number) cv).longValue(); } newCv++; f.set(obj, new Long(newCv)); } // Timestamp else if (f.getType() == Timestamp.class) { long newCv = System.currentTimeMillis(); f.set(obj, new Timestamp(newCv)); } } } }
[ "public", "void", "updateLockingValues", "(", "Object", "obj", ")", "throws", "PersistenceBrokerException", "{", "FieldDescriptor", "[", "]", "fields", "=", "getLockingFields", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "FieldDescriptor", "fmd", "=", "fields", "[", "i", "]", ";", "if", "(", "fmd", ".", "isUpdateLock", "(", ")", ")", "{", "PersistentField", "f", "=", "fmd", ".", "getPersistentField", "(", ")", ";", "Object", "cv", "=", "f", ".", "get", "(", "obj", ")", ";", "// int\r", "if", "(", "(", "f", ".", "getType", "(", ")", "==", "int", ".", "class", ")", "||", "(", "f", ".", "getType", "(", ")", "==", "Integer", ".", "class", ")", ")", "{", "int", "newCv", "=", "0", ";", "if", "(", "cv", "!=", "null", ")", "{", "newCv", "=", "(", "(", "Number", ")", "cv", ")", ".", "intValue", "(", ")", ";", "}", "newCv", "++", ";", "f", ".", "set", "(", "obj", ",", "new", "Integer", "(", "newCv", ")", ")", ";", "}", "// long\r", "else", "if", "(", "(", "f", ".", "getType", "(", ")", "==", "long", ".", "class", ")", "||", "(", "f", ".", "getType", "(", ")", "==", "Long", ".", "class", ")", ")", "{", "long", "newCv", "=", "0", ";", "if", "(", "cv", "!=", "null", ")", "{", "newCv", "=", "(", "(", "Number", ")", "cv", ")", ".", "longValue", "(", ")", ";", "}", "newCv", "++", ";", "f", ".", "set", "(", "obj", ",", "new", "Long", "(", "newCv", ")", ")", ";", "}", "// Timestamp\r", "else", "if", "(", "f", ".", "getType", "(", ")", "==", "Timestamp", ".", "class", ")", "{", "long", "newCv", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "f", ".", "set", "(", "obj", ",", "new", "Timestamp", "(", "newCv", ")", ")", ";", "}", "}", "}", "}" ]
updates the values for locking fields , BRJ handles int, long, Timestamp respects updateLock so locking field are only updated when updateLock is true @throws PersistenceBrokerException if there is an erros accessing obj field values
[ "updates", "the", "values", "for", "locking", "fields", "BRJ", "handles", "int", "long", "Timestamp", "respects", "updateLock", "so", "locking", "field", "are", "only", "updated", "when", "updateLock", "is", "true" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L967-L1007
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.getZeroArgumentConstructor
public Constructor getZeroArgumentConstructor() { if (zeroArgumentConstructor == null && !alreadyLookedupZeroArguments) { try { zeroArgumentConstructor = getClassOfObject().getConstructor(NO_PARAMS); } catch (NoSuchMethodException e) { //no public zero argument constructor available let's try for a private/protected one try { zeroArgumentConstructor = getClassOfObject().getDeclaredConstructor(NO_PARAMS); //we found one, now let's make it accessible zeroArgumentConstructor.setAccessible(true); } catch (NoSuchMethodException e2) { //out of options, log the fact and let the method return null LoggerFactory.getDefaultLogger().warn( this.getClass().getName() + ": " + "No zero argument constructor defined for " + this.getClassOfObject()); } } alreadyLookedupZeroArguments = true; } return zeroArgumentConstructor; }
java
public Constructor getZeroArgumentConstructor() { if (zeroArgumentConstructor == null && !alreadyLookedupZeroArguments) { try { zeroArgumentConstructor = getClassOfObject().getConstructor(NO_PARAMS); } catch (NoSuchMethodException e) { //no public zero argument constructor available let's try for a private/protected one try { zeroArgumentConstructor = getClassOfObject().getDeclaredConstructor(NO_PARAMS); //we found one, now let's make it accessible zeroArgumentConstructor.setAccessible(true); } catch (NoSuchMethodException e2) { //out of options, log the fact and let the method return null LoggerFactory.getDefaultLogger().warn( this.getClass().getName() + ": " + "No zero argument constructor defined for " + this.getClassOfObject()); } } alreadyLookedupZeroArguments = true; } return zeroArgumentConstructor; }
[ "public", "Constructor", "getZeroArgumentConstructor", "(", ")", "{", "if", "(", "zeroArgumentConstructor", "==", "null", "&&", "!", "alreadyLookedupZeroArguments", ")", "{", "try", "{", "zeroArgumentConstructor", "=", "getClassOfObject", "(", ")", ".", "getConstructor", "(", "NO_PARAMS", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "//no public zero argument constructor available let's try for a private/protected one\r", "try", "{", "zeroArgumentConstructor", "=", "getClassOfObject", "(", ")", ".", "getDeclaredConstructor", "(", "NO_PARAMS", ")", ";", "//we found one, now let's make it accessible\r", "zeroArgumentConstructor", ".", "setAccessible", "(", "true", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e2", ")", "{", "//out of options, log the fact and let the method return null\r", "LoggerFactory", ".", "getDefaultLogger", "(", ")", ".", "warn", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\": \"", "+", "\"No zero argument constructor defined for \"", "+", "this", ".", "getClassOfObject", "(", ")", ")", ";", "}", "}", "alreadyLookedupZeroArguments", "=", "true", ";", "}", "return", "zeroArgumentConstructor", ";", "}" ]
returns the zero argument constructor for the class represented by this class descriptor or null if a zero argument constructor does not exist. If the zero argument constructor for this class is not public it is made accessible before being returned.
[ "returns", "the", "zero", "argument", "constructor", "for", "the", "class", "represented", "by", "this", "class", "descriptor", "or", "null", "if", "a", "zero", "argument", "constructor", "does", "not", "exist", ".", "If", "the", "zero", "argument", "constructor", "for", "this", "class", "is", "not", "public", "it", "is", "made", "accessible", "before", "being", "returned", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L1285-L1318
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.setInitializationMethod
private synchronized void setInitializationMethod(Method newMethod) { if (newMethod != null) { // make sure it's a no argument method if (newMethod.getParameterTypes().length > 0) { throw new MetadataException( "Initialization methods must be zero argument methods: " + newMethod.getClass().getName() + "." + newMethod.getName()); } // make it accessible if it's not already if (!newMethod.isAccessible()) { newMethod.setAccessible(true); } } this.initializationMethod = newMethod; }
java
private synchronized void setInitializationMethod(Method newMethod) { if (newMethod != null) { // make sure it's a no argument method if (newMethod.getParameterTypes().length > 0) { throw new MetadataException( "Initialization methods must be zero argument methods: " + newMethod.getClass().getName() + "." + newMethod.getName()); } // make it accessible if it's not already if (!newMethod.isAccessible()) { newMethod.setAccessible(true); } } this.initializationMethod = newMethod; }
[ "private", "synchronized", "void", "setInitializationMethod", "(", "Method", "newMethod", ")", "{", "if", "(", "newMethod", "!=", "null", ")", "{", "// make sure it's a no argument method\r", "if", "(", "newMethod", ".", "getParameterTypes", "(", ")", ".", "length", ">", "0", ")", "{", "throw", "new", "MetadataException", "(", "\"Initialization methods must be zero argument methods: \"", "+", "newMethod", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "newMethod", ".", "getName", "(", ")", ")", ";", "}", "// make it accessible if it's not already\r", "if", "(", "!", "newMethod", ".", "isAccessible", "(", ")", ")", "{", "newMethod", ".", "setAccessible", "(", "true", ")", ";", "}", "}", "this", ".", "initializationMethod", "=", "newMethod", ";", "}" ]
sets the initialization method for this descriptor
[ "sets", "the", "initialization", "method", "for", "this", "descriptor" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L1766-L1787
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
ClassDescriptor.setFactoryMethod
private synchronized void setFactoryMethod(Method newMethod) { if (newMethod != null) { // make sure it's a no argument method if (newMethod.getParameterTypes().length > 0) { throw new MetadataException( "Factory methods must be zero argument methods: " + newMethod.getClass().getName() + "." + newMethod.getName()); } // make it accessible if it's not already if (!newMethod.isAccessible()) { newMethod.setAccessible(true); } } this.factoryMethod = newMethod; }
java
private synchronized void setFactoryMethod(Method newMethod) { if (newMethod != null) { // make sure it's a no argument method if (newMethod.getParameterTypes().length > 0) { throw new MetadataException( "Factory methods must be zero argument methods: " + newMethod.getClass().getName() + "." + newMethod.getName()); } // make it accessible if it's not already if (!newMethod.isAccessible()) { newMethod.setAccessible(true); } } this.factoryMethod = newMethod; }
[ "private", "synchronized", "void", "setFactoryMethod", "(", "Method", "newMethod", ")", "{", "if", "(", "newMethod", "!=", "null", ")", "{", "// make sure it's a no argument method\r", "if", "(", "newMethod", ".", "getParameterTypes", "(", ")", ".", "length", ">", "0", ")", "{", "throw", "new", "MetadataException", "(", "\"Factory methods must be zero argument methods: \"", "+", "newMethod", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "newMethod", ".", "getName", "(", ")", ")", ";", "}", "// make it accessible if it's not already\r", "if", "(", "!", "newMethod", ".", "isAccessible", "(", ")", ")", "{", "newMethod", ".", "setAccessible", "(", "true", ")", ";", "}", "}", "this", ".", "factoryMethod", "=", "newMethod", ";", "}" ]
Specify the method to instantiate objects represented by this descriptor. @see #setFactoryClass
[ "Specify", "the", "method", "to", "instantiate", "objects", "represented", "by", "this", "descriptor", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java#L1927-L1949
train
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationLoggingPatternLayout.java
FoundationLoggingPatternLayout.createPatternParser
protected org.apache.log4j.helpers.PatternParser createPatternParser(final String pattern) { return new FoundationLoggingPatternParser(pattern); }
java
protected org.apache.log4j.helpers.PatternParser createPatternParser(final String pattern) { return new FoundationLoggingPatternParser(pattern); }
[ "protected", "org", ".", "apache", ".", "log4j", ".", "helpers", ".", "PatternParser", "createPatternParser", "(", "final", "String", "pattern", ")", "{", "return", "new", "FoundationLoggingPatternParser", "(", "pattern", ")", ";", "}" ]
Returns PatternParser used to parse the conversion string. Subclasses may override this to return a subclass of PatternParser which recognize custom conversion characters. @since 0.9.0
[ "Returns", "PatternParser", "used", "to", "parse", "the", "conversion", "string", ".", "Subclasses", "may", "override", "this", "to", "return", "a", "subclass", "of", "PatternParser", "which", "recognize", "custom", "conversion", "characters", "." ]
cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationLoggingPatternLayout.java#L93-L95
train
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationLoggingPatternLayout.java
FoundationLoggingPatternLayout.format
public String format(final LoggingEvent event) { final StringBuffer buf = new StringBuffer(); for (PatternConverter c = head; c != null; c = c.next) { c.format(buf, event); } return buf.toString(); }
java
public String format(final LoggingEvent event) { final StringBuffer buf = new StringBuffer(); for (PatternConverter c = head; c != null; c = c.next) { c.format(buf, event); } return buf.toString(); }
[ "public", "String", "format", "(", "final", "LoggingEvent", "event", ")", "{", "final", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "PatternConverter", "c", "=", "head", ";", "c", "!=", "null", ";", "c", "=", "c", ".", "next", ")", "{", "c", ".", "format", "(", "buf", ",", "event", ")", ";", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Formats a logging event to a writer. @param event logging event to be formatted.
[ "Formats", "a", "logging", "event", "to", "a", "writer", "." ]
cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/FoundationLoggingPatternLayout.java#L103-L109
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMSSQLGuidImpl.java
SequenceManagerMSSQLGuidImpl.getUniqueString
protected String getUniqueString(FieldDescriptor field) throws SequenceManagerException { ResultSetAndStatement rsStmt = null; String returnValue = null; try { rsStmt = getBrokerForClass().serviceJdbcAccess().executeSQL( "select newid()", field.getClassDescriptor(), Query.NOT_SCROLLABLE); if (rsStmt.m_rs.next()) { returnValue = rsStmt.m_rs.getString(1); } else { LoggerFactory.getDefaultLogger().error(this.getClass() + ": Can't lookup new oid for field " + field); } } catch (PersistenceBrokerException e) { throw new SequenceManagerException(e); } catch (SQLException e) { throw new SequenceManagerException(e); } finally { // close the used resources if (rsStmt != null) rsStmt.close(); } return returnValue; }
java
protected String getUniqueString(FieldDescriptor field) throws SequenceManagerException { ResultSetAndStatement rsStmt = null; String returnValue = null; try { rsStmt = getBrokerForClass().serviceJdbcAccess().executeSQL( "select newid()", field.getClassDescriptor(), Query.NOT_SCROLLABLE); if (rsStmt.m_rs.next()) { returnValue = rsStmt.m_rs.getString(1); } else { LoggerFactory.getDefaultLogger().error(this.getClass() + ": Can't lookup new oid for field " + field); } } catch (PersistenceBrokerException e) { throw new SequenceManagerException(e); } catch (SQLException e) { throw new SequenceManagerException(e); } finally { // close the used resources if (rsStmt != null) rsStmt.close(); } return returnValue; }
[ "protected", "String", "getUniqueString", "(", "FieldDescriptor", "field", ")", "throws", "SequenceManagerException", "{", "ResultSetAndStatement", "rsStmt", "=", "null", ";", "String", "returnValue", "=", "null", ";", "try", "{", "rsStmt", "=", "getBrokerForClass", "(", ")", ".", "serviceJdbcAccess", "(", ")", ".", "executeSQL", "(", "\"select newid()\"", ",", "field", ".", "getClassDescriptor", "(", ")", ",", "Query", ".", "NOT_SCROLLABLE", ")", ";", "if", "(", "rsStmt", ".", "m_rs", ".", "next", "(", ")", ")", "{", "returnValue", "=", "rsStmt", ".", "m_rs", ".", "getString", "(", "1", ")", ";", "}", "else", "{", "LoggerFactory", ".", "getDefaultLogger", "(", ")", ".", "error", "(", "this", ".", "getClass", "(", ")", "+", "\": Can't lookup new oid for field \"", "+", "field", ")", ";", "}", "}", "catch", "(", "PersistenceBrokerException", "e", ")", "{", "throw", "new", "SequenceManagerException", "(", "e", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "SequenceManagerException", "(", "e", ")", ";", "}", "finally", "{", "// close the used resources\r", "if", "(", "rsStmt", "!=", "null", ")", "rsStmt", ".", "close", "(", ")", ";", "}", "return", "returnValue", ";", "}" ]
returns a unique String for given field. the returned uid is unique accross all tables.
[ "returns", "a", "unique", "String", "for", "given", "field", ".", "the", "returned", "uid", "is", "unique", "accross", "all", "tables", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerMSSQLGuidImpl.java#L77-L110
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java
JdbcTypesHelper.getObjectFromColumn
public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId) throws SQLException { return getObjectFromColumn(rs, null, jdbcType, null, columnId); }
java
public static Object getObjectFromColumn(ResultSet rs, Integer jdbcType, int columnId) throws SQLException { return getObjectFromColumn(rs, null, jdbcType, null, columnId); }
[ "public", "static", "Object", "getObjectFromColumn", "(", "ResultSet", "rs", ",", "Integer", "jdbcType", ",", "int", "columnId", ")", "throws", "SQLException", "{", "return", "getObjectFromColumn", "(", "rs", ",", "null", ",", "jdbcType", ",", "null", ",", "columnId", ")", ";", "}" ]
Returns an java object read from the specified ResultSet column.
[ "Returns", "an", "java", "object", "read", "from", "the", "specified", "ResultSet", "column", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java#L213-L217
train
kuali/ojb-1.0.4
src/tools/org/apache/ojb/tools/mapping/reversedb2/ojbmetatreemodel/OjbMetadataTransferable.java
OjbMetadataTransferable.getTransferData
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, java.io.IOException { if (flavor.isMimeTypeEqual(OJBMETADATA_FLAVOR)) return selectedDescriptors; else throw new UnsupportedFlavorException(flavor); }
java
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, java.io.IOException { if (flavor.isMimeTypeEqual(OJBMETADATA_FLAVOR)) return selectedDescriptors; else throw new UnsupportedFlavorException(flavor); }
[ "public", "Object", "getTransferData", "(", "DataFlavor", "flavor", ")", "throws", "UnsupportedFlavorException", ",", "java", ".", "io", ".", "IOException", "{", "if", "(", "flavor", ".", "isMimeTypeEqual", "(", "OJBMETADATA_FLAVOR", ")", ")", "return", "selectedDescriptors", ";", "else", "throw", "new", "UnsupportedFlavorException", "(", "flavor", ")", ";", "}" ]
Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor. @param flavor the requested flavor for the data @see DataFlavor#getRepresentationClass @exception IOException if the data is no longer available in the requested flavor. @exception UnsupportedFlavorException if the requested data flavor is not supported.
[ "Returns", "an", "object", "which", "represents", "the", "data", "to", "be", "transferred", ".", "The", "class", "of", "the", "object", "returned", "is", "defined", "by", "the", "representation", "class", "of", "the", "flavor", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/ojbmetatreemodel/OjbMetadataTransferable.java#L54-L60
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/configuration/impl/OjbConfiguration.java
OjbConfiguration.load
protected void load() { // properties file may be set as a System property. // if no property is set take default name. String fn = System.getProperty(OJB_PROPERTIES_FILE, OJB_PROPERTIES_FILE); setFilename(fn); super.load(); // default repository & connection descriptor file repositoryFilename = getString("repositoryFile", OJB_METADATA_FILE); // object cache class objectCacheClass = getClass("ObjectCacheClass", ObjectCacheDefaultImpl.class, ObjectCache.class); // load PersistentField Class persistentFieldClass = getClass("PersistentFieldClass", PersistentFieldDirectImpl.class, PersistentField.class); // load PersistenceBroker Class persistenceBrokerClass = getClass("PersistenceBrokerClass", PersistenceBrokerImpl.class, PersistenceBroker.class); // load ListProxy Class listProxyClass = getClass("ListProxyClass", ListProxyDefaultImpl.class); // load SetProxy Class setProxyClass = getClass("SetProxyClass", SetProxyDefaultImpl.class); // load CollectionProxy Class collectionProxyClass = getClass("CollectionProxyClass", CollectionProxyDefaultImpl.class); // load IndirectionHandler Class indirectionHandlerClass = getClass("IndirectionHandlerClass", IndirectionHandlerJDKImpl.class, IndirectionHandler.class); // load ProxyFactory Class proxyFactoryClass = getClass("ProxyFactoryClass", ProxyFactoryJDKImpl.class, ProxyFactory.class); // load configuration for ImplicitLocking parameter: useImplicitLocking = getBoolean("ImplicitLocking", false); // load configuration for LockAssociations parameter: lockAssociationAsWrites = (getString("LockAssociations", "WRITE").equalsIgnoreCase("WRITE")); // load OQL Collection Class oqlCollectionClass = getClass("OqlCollectionClass", DListImpl.class, ManageableCollection.class); // set the limit for IN-sql , -1 for no limits sqlInLimit = getInteger("SqlInLimit", -1); //load configuration for PB pool maxActive = getInteger(PoolConfiguration.MAX_ACTIVE, PoolConfiguration.DEFAULT_MAX_ACTIVE); maxIdle = getInteger(PoolConfiguration.MAX_IDLE, PoolConfiguration.DEFAULT_MAX_IDLE); maxWait = getLong(PoolConfiguration.MAX_WAIT, PoolConfiguration.DEFAULT_MAX_WAIT); timeBetweenEvictionRunsMillis = getLong(PoolConfiguration.TIME_BETWEEN_EVICTION_RUNS_MILLIS, PoolConfiguration.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS); minEvictableIdleTimeMillis = getLong(PoolConfiguration.MIN_EVICTABLE_IDLE_TIME_MILLIS, PoolConfiguration.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS); whenExhaustedAction = getByte(PoolConfiguration.WHEN_EXHAUSTED_ACTION, PoolConfiguration.DEFAULT_WHEN_EXHAUSTED_ACTION); useSerializedRepository = getBoolean("useSerializedRepository", false); }
java
protected void load() { // properties file may be set as a System property. // if no property is set take default name. String fn = System.getProperty(OJB_PROPERTIES_FILE, OJB_PROPERTIES_FILE); setFilename(fn); super.load(); // default repository & connection descriptor file repositoryFilename = getString("repositoryFile", OJB_METADATA_FILE); // object cache class objectCacheClass = getClass("ObjectCacheClass", ObjectCacheDefaultImpl.class, ObjectCache.class); // load PersistentField Class persistentFieldClass = getClass("PersistentFieldClass", PersistentFieldDirectImpl.class, PersistentField.class); // load PersistenceBroker Class persistenceBrokerClass = getClass("PersistenceBrokerClass", PersistenceBrokerImpl.class, PersistenceBroker.class); // load ListProxy Class listProxyClass = getClass("ListProxyClass", ListProxyDefaultImpl.class); // load SetProxy Class setProxyClass = getClass("SetProxyClass", SetProxyDefaultImpl.class); // load CollectionProxy Class collectionProxyClass = getClass("CollectionProxyClass", CollectionProxyDefaultImpl.class); // load IndirectionHandler Class indirectionHandlerClass = getClass("IndirectionHandlerClass", IndirectionHandlerJDKImpl.class, IndirectionHandler.class); // load ProxyFactory Class proxyFactoryClass = getClass("ProxyFactoryClass", ProxyFactoryJDKImpl.class, ProxyFactory.class); // load configuration for ImplicitLocking parameter: useImplicitLocking = getBoolean("ImplicitLocking", false); // load configuration for LockAssociations parameter: lockAssociationAsWrites = (getString("LockAssociations", "WRITE").equalsIgnoreCase("WRITE")); // load OQL Collection Class oqlCollectionClass = getClass("OqlCollectionClass", DListImpl.class, ManageableCollection.class); // set the limit for IN-sql , -1 for no limits sqlInLimit = getInteger("SqlInLimit", -1); //load configuration for PB pool maxActive = getInteger(PoolConfiguration.MAX_ACTIVE, PoolConfiguration.DEFAULT_MAX_ACTIVE); maxIdle = getInteger(PoolConfiguration.MAX_IDLE, PoolConfiguration.DEFAULT_MAX_IDLE); maxWait = getLong(PoolConfiguration.MAX_WAIT, PoolConfiguration.DEFAULT_MAX_WAIT); timeBetweenEvictionRunsMillis = getLong(PoolConfiguration.TIME_BETWEEN_EVICTION_RUNS_MILLIS, PoolConfiguration.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS); minEvictableIdleTimeMillis = getLong(PoolConfiguration.MIN_EVICTABLE_IDLE_TIME_MILLIS, PoolConfiguration.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS); whenExhaustedAction = getByte(PoolConfiguration.WHEN_EXHAUSTED_ACTION, PoolConfiguration.DEFAULT_WHEN_EXHAUSTED_ACTION); useSerializedRepository = getBoolean("useSerializedRepository", false); }
[ "protected", "void", "load", "(", ")", "{", "// properties file may be set as a System property.\r", "// if no property is set take default name.\r", "String", "fn", "=", "System", ".", "getProperty", "(", "OJB_PROPERTIES_FILE", ",", "OJB_PROPERTIES_FILE", ")", ";", "setFilename", "(", "fn", ")", ";", "super", ".", "load", "(", ")", ";", "// default repository & connection descriptor file\r", "repositoryFilename", "=", "getString", "(", "\"repositoryFile\"", ",", "OJB_METADATA_FILE", ")", ";", "// object cache class\r", "objectCacheClass", "=", "getClass", "(", "\"ObjectCacheClass\"", ",", "ObjectCacheDefaultImpl", ".", "class", ",", "ObjectCache", ".", "class", ")", ";", "// load PersistentField Class\r", "persistentFieldClass", "=", "getClass", "(", "\"PersistentFieldClass\"", ",", "PersistentFieldDirectImpl", ".", "class", ",", "PersistentField", ".", "class", ")", ";", "// load PersistenceBroker Class\r", "persistenceBrokerClass", "=", "getClass", "(", "\"PersistenceBrokerClass\"", ",", "PersistenceBrokerImpl", ".", "class", ",", "PersistenceBroker", ".", "class", ")", ";", "// load ListProxy Class\r", "listProxyClass", "=", "getClass", "(", "\"ListProxyClass\"", ",", "ListProxyDefaultImpl", ".", "class", ")", ";", "// load SetProxy Class\r", "setProxyClass", "=", "getClass", "(", "\"SetProxyClass\"", ",", "SetProxyDefaultImpl", ".", "class", ")", ";", "// load CollectionProxy Class\r", "collectionProxyClass", "=", "getClass", "(", "\"CollectionProxyClass\"", ",", "CollectionProxyDefaultImpl", ".", "class", ")", ";", "// load IndirectionHandler Class\r", "indirectionHandlerClass", "=", "getClass", "(", "\"IndirectionHandlerClass\"", ",", "IndirectionHandlerJDKImpl", ".", "class", ",", "IndirectionHandler", ".", "class", ")", ";", "// load ProxyFactory Class\r", "proxyFactoryClass", "=", "getClass", "(", "\"ProxyFactoryClass\"", ",", "ProxyFactoryJDKImpl", ".", "class", ",", "ProxyFactory", ".", "class", ")", ";", "// load configuration for ImplicitLocking parameter:\r", "useImplicitLocking", "=", "getBoolean", "(", "\"ImplicitLocking\"", ",", "false", ")", ";", "// load configuration for LockAssociations parameter:\r", "lockAssociationAsWrites", "=", "(", "getString", "(", "\"LockAssociations\"", ",", "\"WRITE\"", ")", ".", "equalsIgnoreCase", "(", "\"WRITE\"", ")", ")", ";", "// load OQL Collection Class\r", "oqlCollectionClass", "=", "getClass", "(", "\"OqlCollectionClass\"", ",", "DListImpl", ".", "class", ",", "ManageableCollection", ".", "class", ")", ";", "// set the limit for IN-sql , -1 for no limits\r", "sqlInLimit", "=", "getInteger", "(", "\"SqlInLimit\"", ",", "-", "1", ")", ";", "//load configuration for PB pool\r", "maxActive", "=", "getInteger", "(", "PoolConfiguration", ".", "MAX_ACTIVE", ",", "PoolConfiguration", ".", "DEFAULT_MAX_ACTIVE", ")", ";", "maxIdle", "=", "getInteger", "(", "PoolConfiguration", ".", "MAX_IDLE", ",", "PoolConfiguration", ".", "DEFAULT_MAX_IDLE", ")", ";", "maxWait", "=", "getLong", "(", "PoolConfiguration", ".", "MAX_WAIT", ",", "PoolConfiguration", ".", "DEFAULT_MAX_WAIT", ")", ";", "timeBetweenEvictionRunsMillis", "=", "getLong", "(", "PoolConfiguration", ".", "TIME_BETWEEN_EVICTION_RUNS_MILLIS", ",", "PoolConfiguration", ".", "DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS", ")", ";", "minEvictableIdleTimeMillis", "=", "getLong", "(", "PoolConfiguration", ".", "MIN_EVICTABLE_IDLE_TIME_MILLIS", ",", "PoolConfiguration", ".", "DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS", ")", ";", "whenExhaustedAction", "=", "getByte", "(", "PoolConfiguration", ".", "WHEN_EXHAUSTED_ACTION", ",", "PoolConfiguration", ".", "DEFAULT_WHEN_EXHAUSTED_ACTION", ")", ";", "useSerializedRepository", "=", "getBoolean", "(", "\"useSerializedRepository\"", ",", "false", ")", ";", "}" ]
Loads the configuration from file "OBJ.properties". If the system property "OJB.properties" is set, then the configuration in that file is loaded. Otherwise, the file "OJB.properties" is tried. If that is also unsuccessful, then the configuration is filled with default values.
[ "Loads", "the", "configuration", "from", "file", "OBJ", ".", "properties", ".", "If", "the", "system", "property", "OJB", ".", "properties", "is", "set", "then", "the", "configuration", "in", "that", "file", "is", "loaded", ".", "Otherwise", "the", "file", "OJB", ".", "properties", "is", "tried", ".", "If", "that", "is", "also", "unsuccessful", "then", "the", "configuration", "is", "filled", "with", "default", "values", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/OjbConfiguration.java#L231-L297
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java
RemoteLockMapImpl.getReaders
public Collection getReaders(Object obj) { Collection result = null; try { Identity oid = new Identity(obj, getBroker()); byte selector = (byte) 'r'; byte[] requestBarr = buildRequestArray(oid, selector); HttpURLConnection conn = getHttpUrlConnection(); //post request BufferedOutputStream out = new BufferedOutputStream(conn.getOutputStream()); out.write(requestBarr,0,requestBarr.length); out.flush(); // read result from InputStream in = conn.getInputStream(); ObjectInputStream ois = new ObjectInputStream(in); result = (Collection) ois.readObject(); // cleanup ois.close(); out.close(); conn.disconnect(); } catch (Throwable t) { throw new PersistenceBrokerException(t); } return result; }
java
public Collection getReaders(Object obj) { Collection result = null; try { Identity oid = new Identity(obj, getBroker()); byte selector = (byte) 'r'; byte[] requestBarr = buildRequestArray(oid, selector); HttpURLConnection conn = getHttpUrlConnection(); //post request BufferedOutputStream out = new BufferedOutputStream(conn.getOutputStream()); out.write(requestBarr,0,requestBarr.length); out.flush(); // read result from InputStream in = conn.getInputStream(); ObjectInputStream ois = new ObjectInputStream(in); result = (Collection) ois.readObject(); // cleanup ois.close(); out.close(); conn.disconnect(); } catch (Throwable t) { throw new PersistenceBrokerException(t); } return result; }
[ "public", "Collection", "getReaders", "(", "Object", "obj", ")", "{", "Collection", "result", "=", "null", ";", "try", "{", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "byte", "selector", "=", "(", "byte", ")", "'", "'", ";", "byte", "[", "]", "requestBarr", "=", "buildRequestArray", "(", "oid", ",", "selector", ")", ";", "HttpURLConnection", "conn", "=", "getHttpUrlConnection", "(", ")", ";", "//post request\r", "BufferedOutputStream", "out", "=", "new", "BufferedOutputStream", "(", "conn", ".", "getOutputStream", "(", ")", ")", ";", "out", ".", "write", "(", "requestBarr", ",", "0", ",", "requestBarr", ".", "length", ")", ";", "out", ".", "flush", "(", ")", ";", "// read result from \r", "InputStream", "in", "=", "conn", ".", "getInputStream", "(", ")", ";", "ObjectInputStream", "ois", "=", "new", "ObjectInputStream", "(", "in", ")", ";", "result", "=", "(", "Collection", ")", "ois", ".", "readObject", "(", ")", ";", "// cleanup\r", "ois", ".", "close", "(", ")", ";", "out", ".", "close", "(", ")", ";", "conn", ".", "disconnect", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "PersistenceBrokerException", "(", "t", ")", ";", "}", "return", "result", ";", "}" ]
returns a collection of Reader LockEntries for object obj. If now LockEntries could be found an empty Vector is returned.
[ "returns", "a", "collection", "of", "Reader", "LockEntries", "for", "object", "obj", ".", "If", "now", "LockEntries", "could", "be", "found", "an", "empty", "Vector", "is", "returned", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L146-L177
train
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ForeignkeyDef.java
ForeignkeyDef.addColumnPair
public void addColumnPair(String localColumn, String remoteColumn) { if (!_localColumns.contains(localColumn)) { _localColumns.add(localColumn); } if (!_remoteColumns.contains(remoteColumn)) { _remoteColumns.add(remoteColumn); } }
java
public void addColumnPair(String localColumn, String remoteColumn) { if (!_localColumns.contains(localColumn)) { _localColumns.add(localColumn); } if (!_remoteColumns.contains(remoteColumn)) { _remoteColumns.add(remoteColumn); } }
[ "public", "void", "addColumnPair", "(", "String", "localColumn", ",", "String", "remoteColumn", ")", "{", "if", "(", "!", "_localColumns", ".", "contains", "(", "localColumn", ")", ")", "{", "_localColumns", ".", "add", "(", "localColumn", ")", ";", "}", "if", "(", "!", "_remoteColumns", ".", "contains", "(", "remoteColumn", ")", ")", "{", "_remoteColumns", ".", "add", "(", "remoteColumn", ")", ";", "}", "}" ]
Adds a column pair to this foreignkey. @param localColumn The column in the local table @param remoteColumn The column in the remote table
[ "Adds", "a", "column", "pair", "to", "this", "foreignkey", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ForeignkeyDef.java#L60-L70
train
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ColumnWithIdComparator.java
ColumnWithIdComparator.compare
public int compare(Object objA, Object objB) { String idAStr = _table.getColumn((String)objA).getProperty("id"); String idBStr = _table.getColumn((String)objB).getProperty("id"); int idA; int idB; try { idA = Integer.parseInt(idAStr); } catch (Exception ex) { return 1; } try { idB = Integer.parseInt(idBStr); } catch (Exception ex) { return -1; } return idA < idB ? -1 : (idA > idB ? 1 : 0); }
java
public int compare(Object objA, Object objB) { String idAStr = _table.getColumn((String)objA).getProperty("id"); String idBStr = _table.getColumn((String)objB).getProperty("id"); int idA; int idB; try { idA = Integer.parseInt(idAStr); } catch (Exception ex) { return 1; } try { idB = Integer.parseInt(idBStr); } catch (Exception ex) { return -1; } return idA < idB ? -1 : (idA > idB ? 1 : 0); }
[ "public", "int", "compare", "(", "Object", "objA", ",", "Object", "objB", ")", "{", "String", "idAStr", "=", "_table", ".", "getColumn", "(", "(", "String", ")", "objA", ")", ".", "getProperty", "(", "\"id\"", ")", ";", "String", "idBStr", "=", "_table", ".", "getColumn", "(", "(", "String", ")", "objB", ")", ".", "getProperty", "(", "\"id\"", ")", ";", "int", "idA", ";", "int", "idB", ";", "try", "{", "idA", "=", "Integer", ".", "parseInt", "(", "idAStr", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "1", ";", "}", "try", "{", "idB", "=", "Integer", ".", "parseInt", "(", "idBStr", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "-", "1", ";", "}", "return", "idA", "<", "idB", "?", "-", "1", ":", "(", "idA", ">", "idB", "?", "1", ":", "0", ")", ";", "}" ]
Compares two columns given by their names. @param objA The name of the first column @param objB The name of the second column @return @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
[ "Compares", "two", "columns", "given", "by", "their", "names", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ColumnWithIdComparator.java#L52-L72
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/UserAlias.java
UserAlias.getAlias
public String getAlias(String path) { if (m_allPathsAliased && m_attributePath.lastIndexOf(path) != -1) { return m_name; } Object retObj = m_mapping.get(path); if (retObj != null) { return (String) retObj; } return null; }
java
public String getAlias(String path) { if (m_allPathsAliased && m_attributePath.lastIndexOf(path) != -1) { return m_name; } Object retObj = m_mapping.get(path); if (retObj != null) { return (String) retObj; } return null; }
[ "public", "String", "getAlias", "(", "String", "path", ")", "{", "if", "(", "m_allPathsAliased", "&&", "m_attributePath", ".", "lastIndexOf", "(", "path", ")", "!=", "-", "1", ")", "{", "return", "m_name", ";", "}", "Object", "retObj", "=", "m_mapping", ".", "get", "(", "path", ")", ";", "if", "(", "retObj", "!=", "null", ")", "{", "return", "(", "String", ")", "retObj", ";", "}", "return", "null", ";", "}" ]
Returns the name of this alias if path has been added to the aliased portions of attributePath @param path the path to test for inclusion in the alias
[ "Returns", "the", "name", "of", "this", "alias", "if", "path", "has", "been", "added", "to", "the", "aliased", "portions", "of", "attributePath" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/UserAlias.java#L141-L153
train
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ModelDef.java
ModelDef.addClass
public void addClass(ClassDescriptorDef classDef) { classDef.setOwner(this); // Regardless of the format of the class name, we're using the fully qualified format // This is safe because of the package & class naming constraints of the Java language _classDefs.put(classDef.getQualifiedName(), classDef); }
java
public void addClass(ClassDescriptorDef classDef) { classDef.setOwner(this); // Regardless of the format of the class name, we're using the fully qualified format // This is safe because of the package & class naming constraints of the Java language _classDefs.put(classDef.getQualifiedName(), classDef); }
[ "public", "void", "addClass", "(", "ClassDescriptorDef", "classDef", ")", "{", "classDef", ".", "setOwner", "(", "this", ")", ";", "// Regardless of the format of the class name, we're using the fully qualified format\r", "// This is safe because of the package & class naming constraints of the Java language\r", "_classDefs", ".", "put", "(", "classDef", ".", "getQualifiedName", "(", ")", ",", "classDef", ")", ";", "}" ]
Adds the class descriptor to this model. @param classDef The class descriptor @return The class descriptor or <code>null</code> if there is no such class in this model
[ "Adds", "the", "class", "descriptor", "to", "this", "model", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ModelDef.java#L72-L78
train
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ModelDef.java
ModelDef.checkConstraints
public void checkConstraints(String checkLevel) throws ConstraintException { // check constraints now after all classes have been processed for (Iterator it = getClasses(); it.hasNext();) { ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel); } // additional model constraints that either deal with bigger parts of the model or // can only be checked after the individual classes have been checked (e.g. specific // attributes have been ensured) new ModelConstraints().check(this, checkLevel); }
java
public void checkConstraints(String checkLevel) throws ConstraintException { // check constraints now after all classes have been processed for (Iterator it = getClasses(); it.hasNext();) { ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel); } // additional model constraints that either deal with bigger parts of the model or // can only be checked after the individual classes have been checked (e.g. specific // attributes have been ensured) new ModelConstraints().check(this, checkLevel); }
[ "public", "void", "checkConstraints", "(", "String", "checkLevel", ")", "throws", "ConstraintException", "{", "// check constraints now after all classes have been processed\r", "for", "(", "Iterator", "it", "=", "getClasses", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "(", "(", "ClassDescriptorDef", ")", "it", ".", "next", "(", ")", ")", ".", "checkConstraints", "(", "checkLevel", ")", ";", "}", "// additional model constraints that either deal with bigger parts of the model or\r", "// can only be checked after the individual classes have been checked (e.g. specific\r", "// attributes have been ensured)\r", "new", "ModelConstraints", "(", ")", ".", "check", "(", "this", ",", "checkLevel", ")", ";", "}" ]
Checks constraints on this model. @param checkLevel The amount of checks to perform @throws ConstraintException If a constraint has been violated
[ "Checks", "constraints", "on", "this", "model", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ModelDef.java#L128-L139
train
jembi/openhim-mediator-engine-java
src/main/java/org/openhim/mediator/engine/messages/MediatorHTTPResponse.java
MediatorHTTPResponse.toFinishRequest
public FinishRequest toFinishRequest(boolean includeHeaders) { if (includeHeaders) { return new FinishRequest(body, copyHeaders(headers), statusCode); } else { String mime = null; if (body!=null) { mime = "text/plain"; if (headers!=null && (headers.containsKey("Content-Type") || headers.containsKey("content-type"))) { mime = headers.get("Content-Type"); if (mime==null) { mime = headers.get("content-type"); } } } return new FinishRequest(body, mime, statusCode); } }
java
public FinishRequest toFinishRequest(boolean includeHeaders) { if (includeHeaders) { return new FinishRequest(body, copyHeaders(headers), statusCode); } else { String mime = null; if (body!=null) { mime = "text/plain"; if (headers!=null && (headers.containsKey("Content-Type") || headers.containsKey("content-type"))) { mime = headers.get("Content-Type"); if (mime==null) { mime = headers.get("content-type"); } } } return new FinishRequest(body, mime, statusCode); } }
[ "public", "FinishRequest", "toFinishRequest", "(", "boolean", "includeHeaders", ")", "{", "if", "(", "includeHeaders", ")", "{", "return", "new", "FinishRequest", "(", "body", ",", "copyHeaders", "(", "headers", ")", ",", "statusCode", ")", ";", "}", "else", "{", "String", "mime", "=", "null", ";", "if", "(", "body", "!=", "null", ")", "{", "mime", "=", "\"text/plain\"", ";", "if", "(", "headers", "!=", "null", "&&", "(", "headers", ".", "containsKey", "(", "\"Content-Type\"", ")", "||", "headers", ".", "containsKey", "(", "\"content-type\"", ")", ")", ")", "{", "mime", "=", "headers", ".", "get", "(", "\"Content-Type\"", ")", ";", "if", "(", "mime", "==", "null", ")", "{", "mime", "=", "headers", ".", "get", "(", "\"content-type\"", ")", ";", "}", "}", "}", "return", "new", "FinishRequest", "(", "body", ",", "mime", ",", "statusCode", ")", ";", "}", "}" ]
Convert the message to a FinishRequest
[ "Convert", "the", "message", "to", "a", "FinishRequest" ]
02adc0da4302cbde26cc9a5c1ce91ec6277e4f68
https://github.com/jembi/openhim-mediator-engine-java/blob/02adc0da4302cbde26cc9a5c1ce91ec6277e4f68/src/main/java/org/openhim/mediator/engine/messages/MediatorHTTPResponse.java#L57-L74
train
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java
AttributeService.setAttributeEditable
public void setAttributeEditable(Attribute attribute, boolean editable) { attribute.setEditable(editable); if (!(attribute instanceof LazyAttribute)) { // should not instantiate lazy attributes! if (attribute instanceof ManyToOneAttribute) { setAttributeEditable(((ManyToOneAttribute) attribute).getValue(), editable); } else if (attribute instanceof OneToManyAttribute) { List<AssociationValue> values = ((OneToManyAttribute) attribute).getValue(); for (AssociationValue value : values) { setAttributeEditable(value, editable); } } } }
java
public void setAttributeEditable(Attribute attribute, boolean editable) { attribute.setEditable(editable); if (!(attribute instanceof LazyAttribute)) { // should not instantiate lazy attributes! if (attribute instanceof ManyToOneAttribute) { setAttributeEditable(((ManyToOneAttribute) attribute).getValue(), editable); } else if (attribute instanceof OneToManyAttribute) { List<AssociationValue> values = ((OneToManyAttribute) attribute).getValue(); for (AssociationValue value : values) { setAttributeEditable(value, editable); } } } }
[ "public", "void", "setAttributeEditable", "(", "Attribute", "attribute", ",", "boolean", "editable", ")", "{", "attribute", ".", "setEditable", "(", "editable", ")", ";", "if", "(", "!", "(", "attribute", "instanceof", "LazyAttribute", ")", ")", "{", "// should not instantiate lazy attributes!", "if", "(", "attribute", "instanceof", "ManyToOneAttribute", ")", "{", "setAttributeEditable", "(", "(", "(", "ManyToOneAttribute", ")", "attribute", ")", ".", "getValue", "(", ")", ",", "editable", ")", ";", "}", "else", "if", "(", "attribute", "instanceof", "OneToManyAttribute", ")", "{", "List", "<", "AssociationValue", ">", "values", "=", "(", "(", "OneToManyAttribute", ")", "attribute", ")", ".", "getValue", "(", ")", ";", "for", "(", "AssociationValue", "value", ":", "values", ")", "{", "setAttributeEditable", "(", "value", ",", "editable", ")", ";", "}", "}", "}", "}" ]
Set editable state on an attribute. This needs to also set the state on the associated attributes. @param attribute attribute for which the editable state needs to be set @param editable new editable state
[ "Set", "editable", "state", "on", "an", "attribute", ".", "This", "needs", "to", "also", "set", "the", "state", "on", "the", "associated", "attributes", "." ]
904b7d7deed1350d28955589098dd1e0a786d76e
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/layer/feature/AttributeService.java#L124-L136
train
gsi-upm/BeastTool
beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/repositoryMock/RepositoryMockAgent.java
RepositoryMockAgent.increaseBeliefCount
private void increaseBeliefCount(String bName) { Object belief = this.getBelief(bName); int count = 0; if (belief!=null) { count = (Integer) belief; } this.setBelief(bName, count + 1); }
java
private void increaseBeliefCount(String bName) { Object belief = this.getBelief(bName); int count = 0; if (belief!=null) { count = (Integer) belief; } this.setBelief(bName, count + 1); }
[ "private", "void", "increaseBeliefCount", "(", "String", "bName", ")", "{", "Object", "belief", "=", "this", ".", "getBelief", "(", "bName", ")", ";", "int", "count", "=", "0", ";", "if", "(", "belief", "!=", "null", ")", "{", "count", "=", "(", "Integer", ")", "belief", ";", "}", "this", ".", "setBelief", "(", "bName", ",", "count", "+", "1", ")", ";", "}" ]
If the belief its a count of some sort his counting its increased by one. @param bName - the name of the belief count.
[ "If", "the", "belief", "its", "a", "count", "of", "some", "sort", "his", "counting", "its", "increased", "by", "one", "." ]
cc7fdc75cb818c5d60802aaf32c27829e0ca144c
https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/repositoryMock/RepositoryMockAgent.java#L121-L128
train
gsi-upm/BeastTool
beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/repositoryMock/RepositoryMockAgent.java
RepositoryMockAgent.setBelief
private void setBelief(String bName, Object value) { introspector.setBeliefValue(this.getLocalName(), bName, value, null); }
java
private void setBelief(String bName, Object value) { introspector.setBeliefValue(this.getLocalName(), bName, value, null); }
[ "private", "void", "setBelief", "(", "String", "bName", ",", "Object", "value", ")", "{", "introspector", ".", "setBeliefValue", "(", "this", ".", "getLocalName", "(", ")", ",", "bName", ",", "value", ",", "null", ")", ";", "}" ]
Modifies the belief referenced by bName parameter. @param bName - the name of the belief to update. @param value - the new value for the belief
[ "Modifies", "the", "belief", "referenced", "by", "bName", "parameter", "." ]
cc7fdc75cb818c5d60802aaf32c27829e0ca144c
https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/mock/jade/repositoryMock/RepositoryMockAgent.java#L138-L140
train
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createOrganization
public static Organization createOrganization(final String name){ final Organization organization = new Organization(); organization.setName(name); return organization; }
java
public static Organization createOrganization(final String name){ final Organization organization = new Organization(); organization.setName(name); return organization; }
[ "public", "static", "Organization", "createOrganization", "(", "final", "String", "name", ")", "{", "final", "Organization", "organization", "=", "new", "Organization", "(", ")", ";", "organization", ".", "setName", "(", "name", ")", ";", "return", "organization", ";", "}" ]
Generates an organization regarding the parameters. @param name String @return Organization
[ "Generates", "an", "organization", "regarding", "the", "parameters", "." ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L33-L39
train
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createModule
public static Module createModule(final String name,final String version){ final Module module = new Module(); module.setName(name); module.setVersion(version); module.setPromoted(false); return module; }
java
public static Module createModule(final String name,final String version){ final Module module = new Module(); module.setName(name); module.setVersion(version); module.setPromoted(false); return module; }
[ "public", "static", "Module", "createModule", "(", "final", "String", "name", ",", "final", "String", "version", ")", "{", "final", "Module", "module", "=", "new", "Module", "(", ")", ";", "module", ".", "setName", "(", "name", ")", ";", "module", ".", "setVersion", "(", "version", ")", ";", "module", ".", "setPromoted", "(", "false", ")", ";", "return", "module", ";", "}" ]
Generates a module regarding the parameters. @param name String @param version String @return Module
[ "Generates", "a", "module", "regarding", "the", "parameters", "." ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L49-L58
train
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createArtifact
public static Artifact createArtifact(final String groupId, final String artifactId, final String version, final String classifier, final String type, final String extension, final String origin){ final Artifact artifact = new Artifact(); artifact.setGroupId(groupId); artifact.setArtifactId(artifactId); artifact.setVersion(version); if(classifier != null){ artifact.setClassifier(classifier); } if(type != null){ artifact.setType(type); } if(extension != null){ artifact.setExtension(extension); } artifact.setOrigin(origin == null ? "maven" : origin); return artifact; }
java
public static Artifact createArtifact(final String groupId, final String artifactId, final String version, final String classifier, final String type, final String extension, final String origin){ final Artifact artifact = new Artifact(); artifact.setGroupId(groupId); artifact.setArtifactId(artifactId); artifact.setVersion(version); if(classifier != null){ artifact.setClassifier(classifier); } if(type != null){ artifact.setType(type); } if(extension != null){ artifact.setExtension(extension); } artifact.setOrigin(origin == null ? "maven" : origin); return artifact; }
[ "public", "static", "Artifact", "createArtifact", "(", "final", "String", "groupId", ",", "final", "String", "artifactId", ",", "final", "String", "version", ",", "final", "String", "classifier", ",", "final", "String", "type", ",", "final", "String", "extension", ",", "final", "String", "origin", ")", "{", "final", "Artifact", "artifact", "=", "new", "Artifact", "(", ")", ";", "artifact", ".", "setGroupId", "(", "groupId", ")", ";", "artifact", ".", "setArtifactId", "(", "artifactId", ")", ";", "artifact", ".", "setVersion", "(", "version", ")", ";", "if", "(", "classifier", "!=", "null", ")", "{", "artifact", ".", "setClassifier", "(", "classifier", ")", ";", "}", "if", "(", "type", "!=", "null", ")", "{", "artifact", ".", "setType", "(", "type", ")", ";", "}", "if", "(", "extension", "!=", "null", ")", "{", "artifact", ".", "setExtension", "(", "extension", ")", ";", "}", "artifact", ".", "setOrigin", "(", "origin", "==", "null", "?", "\"maven\"", ":", "origin", ")", ";", "return", "artifact", ";", "}" ]
Generates an artifact regarding the parameters. <P> <b>WARNING:</b> The parameters grId/arId/version should be filled!!! Only classifier and type are not mandatory. @param groupId String @param artifactId String @param version String @param classifier String @param type String @param extension String @return Artifact
[ "Generates", "an", "artifact", "regarding", "the", "parameters", "." ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L90-L112
train
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createLicense
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){ final License license = new License(); license.setName(name); license.setLongName(longName); license.setComments(comments); license.setRegexp(regexp); license.setUrl(url); return license; }
java
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){ final License license = new License(); license.setName(name); license.setLongName(longName); license.setComments(comments); license.setRegexp(regexp); license.setUrl(url); return license; }
[ "public", "static", "License", "createLicense", "(", "final", "String", "name", ",", "final", "String", "longName", ",", "final", "String", "comments", ",", "final", "String", "regexp", ",", "final", "String", "url", ")", "{", "final", "License", "license", "=", "new", "License", "(", ")", ";", "license", ".", "setName", "(", "name", ")", ";", "license", ".", "setLongName", "(", "longName", ")", ";", "license", ".", "setComments", "(", "comments", ")", ";", "license", ".", "setRegexp", "(", "regexp", ")", ";", "license", ".", "setUrl", "(", "url", ")", ";", "return", "license", ";", "}" ]
Generates a License regarding the parameters. @param name String @param longName String @param comments String @param regexp String @param url String @return License
[ "Generates", "a", "License", "regarding", "the", "parameters", "." ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L124-L134
train
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createComment
public static Comment createComment(final String entityId, final String entityType, final String action, final String commentedText, final String user, final Date date) { final Comment comment = new Comment(); comment.setEntityId(entityId); comment.setEntityType(entityType); comment.setAction(action); comment.setCommentText(commentedText); comment.setCommentedBy(user); comment.setCreatedDateTime(date); return comment; }
java
public static Comment createComment(final String entityId, final String entityType, final String action, final String commentedText, final String user, final Date date) { final Comment comment = new Comment(); comment.setEntityId(entityId); comment.setEntityType(entityType); comment.setAction(action); comment.setCommentText(commentedText); comment.setCommentedBy(user); comment.setCreatedDateTime(date); return comment; }
[ "public", "static", "Comment", "createComment", "(", "final", "String", "entityId", ",", "final", "String", "entityType", ",", "final", "String", "action", ",", "final", "String", "commentedText", ",", "final", "String", "user", ",", "final", "Date", "date", ")", "{", "final", "Comment", "comment", "=", "new", "Comment", "(", ")", ";", "comment", ".", "setEntityId", "(", "entityId", ")", ";", "comment", ".", "setEntityType", "(", "entityType", ")", ";", "comment", ".", "setAction", "(", "action", ")", ";", "comment", ".", "setCommentText", "(", "commentedText", ")", ";", "comment", ".", "setCommentedBy", "(", "user", ")", ";", "comment", ".", "setCreatedDateTime", "(", "date", ")", ";", "return", "comment", ";", "}" ]
Generates a comment regarding the parameters. @param entityId - id of the commented entity @param entityType - type of the entity @param action - the action performed by the user @param commentedText - comment text @param user - comment left by @param date - date comment was created @return - comment entity
[ "Generates", "a", "comment", "regarding", "the", "parameters", "." ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L247-L262
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.writeAllEnvelopes
private void writeAllEnvelopes(boolean reuse) { // perform remove of m:n indirection table entries first performM2NUnlinkEntries(); Iterator iter; // using clone to avoid ConcurentModificationException iter = ((List) mvOrderOfIds.clone()).iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); boolean insert = false; if(needsCommit) { insert = mod.needsInsert(); mod.getModificationState().commit(mod); if(reuse && insert) { getTransaction().doSingleLock(mod.getClassDescriptor(), mod.getObject(), mod.getIdentity(), Transaction.WRITE); } } /* arminw: important to call this cleanup method for each registered ObjectEnvelope, because this method will e.g. remove proxy listener objects for registered objects. */ mod.cleanup(reuse, insert); } // add m:n indirection table entries performM2NLinkEntries(); }
java
private void writeAllEnvelopes(boolean reuse) { // perform remove of m:n indirection table entries first performM2NUnlinkEntries(); Iterator iter; // using clone to avoid ConcurentModificationException iter = ((List) mvOrderOfIds.clone()).iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); boolean insert = false; if(needsCommit) { insert = mod.needsInsert(); mod.getModificationState().commit(mod); if(reuse && insert) { getTransaction().doSingleLock(mod.getClassDescriptor(), mod.getObject(), mod.getIdentity(), Transaction.WRITE); } } /* arminw: important to call this cleanup method for each registered ObjectEnvelope, because this method will e.g. remove proxy listener objects for registered objects. */ mod.cleanup(reuse, insert); } // add m:n indirection table entries performM2NLinkEntries(); }
[ "private", "void", "writeAllEnvelopes", "(", "boolean", "reuse", ")", "{", "// perform remove of m:n indirection table entries first\r", "performM2NUnlinkEntries", "(", ")", ";", "Iterator", "iter", ";", "// using clone to avoid ConcurentModificationException\r", "iter", "=", "(", "(", "List", ")", "mvOrderOfIds", ".", "clone", "(", ")", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "ObjectEnvelope", "mod", "=", "(", "ObjectEnvelope", ")", "mhtObjectEnvelopes", ".", "get", "(", "iter", ".", "next", "(", ")", ")", ";", "boolean", "insert", "=", "false", ";", "if", "(", "needsCommit", ")", "{", "insert", "=", "mod", ".", "needsInsert", "(", ")", ";", "mod", ".", "getModificationState", "(", ")", ".", "commit", "(", "mod", ")", ";", "if", "(", "reuse", "&&", "insert", ")", "{", "getTransaction", "(", ")", ".", "doSingleLock", "(", "mod", ".", "getClassDescriptor", "(", ")", ",", "mod", ".", "getObject", "(", ")", ",", "mod", ".", "getIdentity", "(", ")", ",", "Transaction", ".", "WRITE", ")", ";", "}", "}", "/*\r\n arminw: important to call this cleanup method for each registered\r\n ObjectEnvelope, because this method will e.g. remove proxy listener\r\n objects for registered objects.\r\n */", "mod", ".", "cleanup", "(", "reuse", ",", "insert", ")", ";", "}", "// add m:n indirection table entries\r", "performM2NLinkEntries", "(", ")", ";", "}" ]
commit all envelopes against the current broker
[ "commit", "all", "envelopes", "against", "the", "current", "broker" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L226-L256
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.checkAllEnvelopes
private void checkAllEnvelopes(PersistenceBroker broker) { Iterator iter = ((List) mvOrderOfIds.clone()).iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); // only non transient objects should be performed if(!mod.getModificationState().isTransient()) { mod.markReferenceElements(broker); } } }
java
private void checkAllEnvelopes(PersistenceBroker broker) { Iterator iter = ((List) mvOrderOfIds.clone()).iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); // only non transient objects should be performed if(!mod.getModificationState().isTransient()) { mod.markReferenceElements(broker); } } }
[ "private", "void", "checkAllEnvelopes", "(", "PersistenceBroker", "broker", ")", "{", "Iterator", "iter", "=", "(", "(", "List", ")", "mvOrderOfIds", ".", "clone", "(", ")", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "ObjectEnvelope", "mod", "=", "(", "ObjectEnvelope", ")", "mhtObjectEnvelopes", ".", "get", "(", "iter", ".", "next", "(", ")", ")", ";", "// only non transient objects should be performed\r", "if", "(", "!", "mod", ".", "getModificationState", "(", ")", ".", "isTransient", "(", ")", ")", "{", "mod", ".", "markReferenceElements", "(", "broker", ")", ";", "}", "}", "}" ]
Mark objects no longer available in collection for delete and new objects for insert. @param broker the PB to persist all objects
[ "Mark", "objects", "no", "longer", "available", "in", "collection", "for", "delete", "and", "new", "objects", "for", "insert", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L263-L275
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.rollback
public void rollback() { try { Iterator iter = mvOrderOfIds.iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); if(log.isDebugEnabled()) log.debug("rollback: " + mod); // if the Object has been modified by transaction, mark object as dirty if(mod.hasChanged(transaction.getBroker())) { mod.setModificationState(mod.getModificationState().markDirty()); } mod.getModificationState().rollback(mod); } } finally { needsCommit = false; } afterWriteCleanup(); }
java
public void rollback() { try { Iterator iter = mvOrderOfIds.iterator(); while(iter.hasNext()) { ObjectEnvelope mod = (ObjectEnvelope) mhtObjectEnvelopes.get(iter.next()); if(log.isDebugEnabled()) log.debug("rollback: " + mod); // if the Object has been modified by transaction, mark object as dirty if(mod.hasChanged(transaction.getBroker())) { mod.setModificationState(mod.getModificationState().markDirty()); } mod.getModificationState().rollback(mod); } } finally { needsCommit = false; } afterWriteCleanup(); }
[ "public", "void", "rollback", "(", ")", "{", "try", "{", "Iterator", "iter", "=", "mvOrderOfIds", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "ObjectEnvelope", "mod", "=", "(", "ObjectEnvelope", ")", "mhtObjectEnvelopes", ".", "get", "(", "iter", ".", "next", "(", ")", ")", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"rollback: \"", "+", "mod", ")", ";", "// if the Object has been modified by transaction, mark object as dirty\r", "if", "(", "mod", ".", "hasChanged", "(", "transaction", ".", "getBroker", "(", ")", ")", ")", "{", "mod", ".", "setModificationState", "(", "mod", ".", "getModificationState", "(", ")", ".", "markDirty", "(", ")", ")", ";", "}", "mod", ".", "getModificationState", "(", ")", ".", "rollback", "(", "mod", ")", ";", "}", "}", "finally", "{", "needsCommit", "=", "false", ";", "}", "afterWriteCleanup", "(", ")", ";", "}" ]
perform rollback on all tx-states
[ "perform", "rollback", "on", "all", "tx", "-", "states" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L349-L372
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.remove
public void remove(Object pKey) { Identity id; if(pKey instanceof Identity) { id = (Identity) pKey; } else { id = transaction.getBroker().serviceIdentity().buildIdentity(pKey); } mhtObjectEnvelopes.remove(id); mvOrderOfIds.remove(id); }
java
public void remove(Object pKey) { Identity id; if(pKey instanceof Identity) { id = (Identity) pKey; } else { id = transaction.getBroker().serviceIdentity().buildIdentity(pKey); } mhtObjectEnvelopes.remove(id); mvOrderOfIds.remove(id); }
[ "public", "void", "remove", "(", "Object", "pKey", ")", "{", "Identity", "id", ";", "if", "(", "pKey", "instanceof", "Identity", ")", "{", "id", "=", "(", "Identity", ")", "pKey", ";", "}", "else", "{", "id", "=", "transaction", ".", "getBroker", "(", ")", ".", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "pKey", ")", ";", "}", "mhtObjectEnvelopes", ".", "remove", "(", "id", ")", ";", "mvOrderOfIds", ".", "remove", "(", "id", ")", ";", "}" ]
remove an objects entry from the object registry
[ "remove", "an", "objects", "entry", "from", "the", "object", "registry" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L375-L388
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.reorder
private void reorder() { if(getTransaction().isOrdering() && needsCommit && mhtObjectEnvelopes.size() > 1) { ObjectEnvelopeOrdering ordering = new ObjectEnvelopeOrdering(mvOrderOfIds, mhtObjectEnvelopes); ordering.reorder(); Identity[] newOrder = ordering.getOrdering(); mvOrderOfIds.clear(); for(int i = 0; i < newOrder.length; i++) { mvOrderOfIds.add(newOrder[i]); } } }
java
private void reorder() { if(getTransaction().isOrdering() && needsCommit && mhtObjectEnvelopes.size() > 1) { ObjectEnvelopeOrdering ordering = new ObjectEnvelopeOrdering(mvOrderOfIds, mhtObjectEnvelopes); ordering.reorder(); Identity[] newOrder = ordering.getOrdering(); mvOrderOfIds.clear(); for(int i = 0; i < newOrder.length; i++) { mvOrderOfIds.add(newOrder[i]); } } }
[ "private", "void", "reorder", "(", ")", "{", "if", "(", "getTransaction", "(", ")", ".", "isOrdering", "(", ")", "&&", "needsCommit", "&&", "mhtObjectEnvelopes", ".", "size", "(", ")", ">", "1", ")", "{", "ObjectEnvelopeOrdering", "ordering", "=", "new", "ObjectEnvelopeOrdering", "(", "mvOrderOfIds", ",", "mhtObjectEnvelopes", ")", ";", "ordering", ".", "reorder", "(", ")", ";", "Identity", "[", "]", "newOrder", "=", "ordering", ".", "getOrdering", "(", ")", ";", "mvOrderOfIds", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "newOrder", ".", "length", ";", "i", "++", ")", "{", "mvOrderOfIds", ".", "add", "(", "newOrder", "[", "i", "]", ")", ";", "}", "}", "}" ]
Reorder the objects in the table to resolve referential integrity dependencies.
[ "Reorder", "the", "objects", "in", "the", "table", "to", "resolve", "referential", "integrity", "dependencies", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L464-L478
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeMarkedForInsert
private void cascadeMarkedForInsert() { // This list was used to avoid endless recursion on circular references List alreadyPrepared = new ArrayList(); for(int i = 0; i < markedForInsertList.size(); i++) { ObjectEnvelope mod = (ObjectEnvelope) markedForInsertList.get(i); // only if a new object was found we cascade to register the dependent objects if(mod.needsInsert()) { cascadeInsertFor(mod, alreadyPrepared); alreadyPrepared.clear(); } } markedForInsertList.clear(); }
java
private void cascadeMarkedForInsert() { // This list was used to avoid endless recursion on circular references List alreadyPrepared = new ArrayList(); for(int i = 0; i < markedForInsertList.size(); i++) { ObjectEnvelope mod = (ObjectEnvelope) markedForInsertList.get(i); // only if a new object was found we cascade to register the dependent objects if(mod.needsInsert()) { cascadeInsertFor(mod, alreadyPrepared); alreadyPrepared.clear(); } } markedForInsertList.clear(); }
[ "private", "void", "cascadeMarkedForInsert", "(", ")", "{", "// This list was used to avoid endless recursion on circular references\r", "List", "alreadyPrepared", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "markedForInsertList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ObjectEnvelope", "mod", "=", "(", "ObjectEnvelope", ")", "markedForInsertList", ".", "get", "(", "i", ")", ";", "// only if a new object was found we cascade to register the dependent objects\r", "if", "(", "mod", ".", "needsInsert", "(", ")", ")", "{", "cascadeInsertFor", "(", "mod", ",", "alreadyPrepared", ")", ";", "alreadyPrepared", ".", "clear", "(", ")", ";", "}", "}", "markedForInsertList", ".", "clear", "(", ")", ";", "}" ]
Starts recursive insert on all insert objects object graph
[ "Starts", "recursive", "insert", "on", "all", "insert", "objects", "object", "graph" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L524-L539
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeInsertFor
private void cascadeInsertFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion, so use List for registration if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeInsertSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeInsertCollectionReferences(mod, colls, alreadyPrepared); }
java
private void cascadeInsertFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion, so use List for registration if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeInsertSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeInsertCollectionReferences(mod, colls, alreadyPrepared); }
[ "private", "void", "cascadeInsertFor", "(", "ObjectEnvelope", "mod", ",", "List", "alreadyPrepared", ")", "{", "// avoid endless recursion, so use List for registration\r", "if", "(", "alreadyPrepared", ".", "contains", "(", "mod", ".", "getIdentity", "(", ")", ")", ")", "return", ";", "alreadyPrepared", ".", "add", "(", "mod", ".", "getIdentity", "(", ")", ")", ";", "ClassDescriptor", "cld", "=", "getTransaction", "(", ")", ".", "getBroker", "(", ")", ".", "getClassDescriptor", "(", "mod", ".", "getObject", "(", ")", ".", "getClass", "(", ")", ")", ";", "List", "refs", "=", "cld", ".", "getObjectReferenceDescriptors", "(", "true", ")", ";", "cascadeInsertSingleReferences", "(", "mod", ",", "refs", ",", "alreadyPrepared", ")", ";", "List", "colls", "=", "cld", ".", "getCollectionDescriptors", "(", "true", ")", ";", "cascadeInsertCollectionReferences", "(", "mod", ",", "colls", ",", "alreadyPrepared", ")", ";", "}" ]
Walk through the object graph of the specified insert object. Was used for recursive object graph walk.
[ "Walk", "through", "the", "object", "graph", "of", "the", "specified", "insert", "object", ".", "Was", "used", "for", "recursive", "object", "graph", "walk", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L545-L558
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeMarkedForDeletion
private void cascadeMarkedForDeletion() { List alreadyPrepared = new ArrayList(); for(int i = 0; i < markedForDeletionList.size(); i++) { ObjectEnvelope mod = (ObjectEnvelope) markedForDeletionList.get(i); // if the object wasn't associated with another object, start cascade delete if(!isNewAssociatedObject(mod.getIdentity())) { cascadeDeleteFor(mod, alreadyPrepared); alreadyPrepared.clear(); } } markedForDeletionList.clear(); }
java
private void cascadeMarkedForDeletion() { List alreadyPrepared = new ArrayList(); for(int i = 0; i < markedForDeletionList.size(); i++) { ObjectEnvelope mod = (ObjectEnvelope) markedForDeletionList.get(i); // if the object wasn't associated with another object, start cascade delete if(!isNewAssociatedObject(mod.getIdentity())) { cascadeDeleteFor(mod, alreadyPrepared); alreadyPrepared.clear(); } } markedForDeletionList.clear(); }
[ "private", "void", "cascadeMarkedForDeletion", "(", ")", "{", "List", "alreadyPrepared", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "markedForDeletionList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ObjectEnvelope", "mod", "=", "(", "ObjectEnvelope", ")", "markedForDeletionList", ".", "get", "(", "i", ")", ";", "// if the object wasn't associated with another object, start cascade delete\r", "if", "(", "!", "isNewAssociatedObject", "(", "mod", ".", "getIdentity", "(", ")", ")", ")", "{", "cascadeDeleteFor", "(", "mod", ",", "alreadyPrepared", ")", ";", "alreadyPrepared", ".", "clear", "(", ")", ";", "}", "}", "markedForDeletionList", ".", "clear", "(", ")", ";", "}" ]
Starts recursive delete on all delete objects object graph
[ "Starts", "recursive", "delete", "on", "all", "delete", "objects", "object", "graph" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L678-L692
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeDeleteFor
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
java
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
[ "private", "void", "cascadeDeleteFor", "(", "ObjectEnvelope", "mod", ",", "List", "alreadyPrepared", ")", "{", "// avoid endless recursion\r", "if", "(", "alreadyPrepared", ".", "contains", "(", "mod", ".", "getIdentity", "(", ")", ")", ")", "return", ";", "alreadyPrepared", ".", "add", "(", "mod", ".", "getIdentity", "(", ")", ")", ";", "ClassDescriptor", "cld", "=", "getTransaction", "(", ")", ".", "getBroker", "(", ")", ".", "getClassDescriptor", "(", "mod", ".", "getObject", "(", ")", ".", "getClass", "(", ")", ")", ";", "List", "refs", "=", "cld", ".", "getObjectReferenceDescriptors", "(", "true", ")", ";", "cascadeDeleteSingleReferences", "(", "mod", ",", "refs", ",", "alreadyPrepared", ")", ";", "List", "colls", "=", "cld", ".", "getCollectionDescriptors", "(", "true", ")", ";", "cascadeDeleteCollectionReferences", "(", "mod", ",", "colls", ",", "alreadyPrepared", ")", ";", "}" ]
Walk through the object graph of the specified delete object. Was used for recursive object graph walk.
[ "Walk", "through", "the", "object", "graph", "of", "the", "specified", "delete", "object", ".", "Was", "used", "for", "recursive", "object", "graph", "walk", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L698-L712
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.getCollectionByQuery
public ManageableCollection getCollectionByQuery(Class collectionClass, Query query, boolean lazy) throws PersistenceBrokerException { ManageableCollection result; try { // BRJ: return empty Collection for null query if (query == null) { result = (ManageableCollection)collectionClass.newInstance(); } else { if (lazy) { result = pb.getProxyFactory().createCollectionProxy(pb.getPBKey(), query, collectionClass); } else { result = getCollectionByQuery(collectionClass, query.getSearchClass(), query); } } return result; } catch (Exception e) { if(e instanceof PersistenceBrokerException) { throw (PersistenceBrokerException) e; } else { throw new PersistenceBrokerException(e); } } }
java
public ManageableCollection getCollectionByQuery(Class collectionClass, Query query, boolean lazy) throws PersistenceBrokerException { ManageableCollection result; try { // BRJ: return empty Collection for null query if (query == null) { result = (ManageableCollection)collectionClass.newInstance(); } else { if (lazy) { result = pb.getProxyFactory().createCollectionProxy(pb.getPBKey(), query, collectionClass); } else { result = getCollectionByQuery(collectionClass, query.getSearchClass(), query); } } return result; } catch (Exception e) { if(e instanceof PersistenceBrokerException) { throw (PersistenceBrokerException) e; } else { throw new PersistenceBrokerException(e); } } }
[ "public", "ManageableCollection", "getCollectionByQuery", "(", "Class", "collectionClass", ",", "Query", "query", ",", "boolean", "lazy", ")", "throws", "PersistenceBrokerException", "{", "ManageableCollection", "result", ";", "try", "{", "// BRJ: return empty Collection for null query\r", "if", "(", "query", "==", "null", ")", "{", "result", "=", "(", "ManageableCollection", ")", "collectionClass", ".", "newInstance", "(", ")", ";", "}", "else", "{", "if", "(", "lazy", ")", "{", "result", "=", "pb", ".", "getProxyFactory", "(", ")", ".", "createCollectionProxy", "(", "pb", ".", "getPBKey", "(", ")", ",", "query", ",", "collectionClass", ")", ";", "}", "else", "{", "result", "=", "getCollectionByQuery", "(", "collectionClass", ",", "query", ".", "getSearchClass", "(", ")", ",", "query", ")", ";", "}", "}", "return", "result", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "e", "instanceof", "PersistenceBrokerException", ")", "{", "throw", "(", "PersistenceBrokerException", ")", "e", ";", "}", "else", "{", "throw", "new", "PersistenceBrokerException", "(", "e", ")", ";", "}", "}", "}" ]
retrieve a collection of type collectionClass matching the Query query if lazy = true return a CollectionProxy @param collectionClass @param query @param lazy @return ManageableCollection @throws PersistenceBrokerException
[ "retrieve", "a", "collection", "of", "type", "collectionClass", "matching", "the", "Query", "query", "if", "lazy", "=", "true", "return", "a", "CollectionProxy" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L244-L279
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveReferences
public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { Iterator i = cld.getObjectReferenceDescriptors().iterator(); // turn off auto prefetching for related proxies final Class saveClassToPrefetch = classToPrefetch; classToPrefetch = null; pb.getInternalCache().enableMaterializationCache(); try { while (i.hasNext()) { ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next(); retrieveReference(newObj, cld, rds, forced); } pb.getInternalCache().disableMaterializationCache(); } catch(RuntimeException e) { pb.getInternalCache().doLocalClear(); throw e; } finally { classToPrefetch = saveClassToPrefetch; } }
java
public void retrieveReferences(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { Iterator i = cld.getObjectReferenceDescriptors().iterator(); // turn off auto prefetching for related proxies final Class saveClassToPrefetch = classToPrefetch; classToPrefetch = null; pb.getInternalCache().enableMaterializationCache(); try { while (i.hasNext()) { ObjectReferenceDescriptor rds = (ObjectReferenceDescriptor) i.next(); retrieveReference(newObj, cld, rds, forced); } pb.getInternalCache().disableMaterializationCache(); } catch(RuntimeException e) { pb.getInternalCache().doLocalClear(); throw e; } finally { classToPrefetch = saveClassToPrefetch; } }
[ "public", "void", "retrieveReferences", "(", "Object", "newObj", ",", "ClassDescriptor", "cld", ",", "boolean", "forced", ")", "throws", "PersistenceBrokerException", "{", "Iterator", "i", "=", "cld", ".", "getObjectReferenceDescriptors", "(", ")", ".", "iterator", "(", ")", ";", "// turn off auto prefetching for related proxies\r", "final", "Class", "saveClassToPrefetch", "=", "classToPrefetch", ";", "classToPrefetch", "=", "null", ";", "pb", ".", "getInternalCache", "(", ")", ".", "enableMaterializationCache", "(", ")", ";", "try", "{", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "ObjectReferenceDescriptor", "rds", "=", "(", "ObjectReferenceDescriptor", ")", "i", ".", "next", "(", ")", ";", "retrieveReference", "(", "newObj", ",", "cld", ",", "rds", ",", "forced", ")", ";", "}", "pb", ".", "getInternalCache", "(", ")", ".", "disableMaterializationCache", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "pb", ".", "getInternalCache", "(", ")", ".", "doLocalClear", "(", ")", ";", "throw", "e", ";", "}", "finally", "{", "classToPrefetch", "=", "saveClassToPrefetch", ";", "}", "}" ]
Retrieve all References @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true loading is forced even if cld differs.
[ "Retrieve", "all", "References" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L524-L552
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.hasNullifiedFK
private boolean hasNullifiedFK(FieldDescriptor[] fkFieldDescriptors, Object[] fkValues) { boolean result = true; for (int i = 0; i < fkValues.length; i++) { if (!pb.serviceBrokerHelper().representsNull(fkFieldDescriptors[i], fkValues[i])) { result = false; break; } } return result; }
java
private boolean hasNullifiedFK(FieldDescriptor[] fkFieldDescriptors, Object[] fkValues) { boolean result = true; for (int i = 0; i < fkValues.length; i++) { if (!pb.serviceBrokerHelper().representsNull(fkFieldDescriptors[i], fkValues[i])) { result = false; break; } } return result; }
[ "private", "boolean", "hasNullifiedFK", "(", "FieldDescriptor", "[", "]", "fkFieldDescriptors", ",", "Object", "[", "]", "fkValues", ")", "{", "boolean", "result", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fkValues", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "pb", ".", "serviceBrokerHelper", "(", ")", ".", "representsNull", "(", "fkFieldDescriptors", "[", "i", "]", ",", "fkValues", "[", "i", "]", ")", ")", "{", "result", "=", "false", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
to avoid creation of unmaterializable proxies
[ "to", "avoid", "creation", "of", "unmaterializable", "proxies" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L631-L643
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.getFKQuery
private Query getFKQuery(Object obj, ClassDescriptor cld, CollectionDescriptor cds) { Query fkQuery; QueryByCriteria fkQueryCrit; if (cds.isMtoNRelation()) { fkQueryCrit = getFKQueryMtoN(obj, cld, cds); } else { fkQueryCrit = getFKQuery1toN(obj, cld, cds); } // check if collection must be ordered if (!cds.getOrderBy().isEmpty()) { Iterator iter = cds.getOrderBy().iterator(); while (iter.hasNext()) { fkQueryCrit.addOrderBy((FieldHelper)iter.next()); } } // BRJ: customize the query if (cds.getQueryCustomizer() != null) { fkQuery = cds.getQueryCustomizer().customizeQuery(obj, pb, cds, fkQueryCrit); } else { fkQuery = fkQueryCrit; } return fkQuery; }
java
private Query getFKQuery(Object obj, ClassDescriptor cld, CollectionDescriptor cds) { Query fkQuery; QueryByCriteria fkQueryCrit; if (cds.isMtoNRelation()) { fkQueryCrit = getFKQueryMtoN(obj, cld, cds); } else { fkQueryCrit = getFKQuery1toN(obj, cld, cds); } // check if collection must be ordered if (!cds.getOrderBy().isEmpty()) { Iterator iter = cds.getOrderBy().iterator(); while (iter.hasNext()) { fkQueryCrit.addOrderBy((FieldHelper)iter.next()); } } // BRJ: customize the query if (cds.getQueryCustomizer() != null) { fkQuery = cds.getQueryCustomizer().customizeQuery(obj, pb, cds, fkQueryCrit); } else { fkQuery = fkQueryCrit; } return fkQuery; }
[ "private", "Query", "getFKQuery", "(", "Object", "obj", ",", "ClassDescriptor", "cld", ",", "CollectionDescriptor", "cds", ")", "{", "Query", "fkQuery", ";", "QueryByCriteria", "fkQueryCrit", ";", "if", "(", "cds", ".", "isMtoNRelation", "(", ")", ")", "{", "fkQueryCrit", "=", "getFKQueryMtoN", "(", "obj", ",", "cld", ",", "cds", ")", ";", "}", "else", "{", "fkQueryCrit", "=", "getFKQuery1toN", "(", "obj", ",", "cld", ",", "cds", ")", ";", "}", "// check if collection must be ordered\r", "if", "(", "!", "cds", ".", "getOrderBy", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Iterator", "iter", "=", "cds", ".", "getOrderBy", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "fkQueryCrit", ".", "addOrderBy", "(", "(", "FieldHelper", ")", "iter", ".", "next", "(", ")", ")", ";", "}", "}", "// BRJ: customize the query\r", "if", "(", "cds", ".", "getQueryCustomizer", "(", ")", "!=", "null", ")", "{", "fkQuery", "=", "cds", ".", "getQueryCustomizer", "(", ")", ".", "customizeQuery", "(", "obj", ",", "pb", ",", "cds", ",", "fkQueryCrit", ")", ";", "}", "else", "{", "fkQuery", "=", "fkQueryCrit", ";", "}", "return", "fkQuery", ";", "}" ]
Answer the foreign key query to retrieve the collection defined by CollectionDescriptor
[ "Answer", "the", "foreign", "key", "query", "to", "retrieve", "the", "collection", "defined", "by", "CollectionDescriptor" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L820-L855
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.getPKQuery
public Query getPKQuery(Identity oid) { Object[] values = oid.getPrimaryKeyValues(); ClassDescriptor cld = pb.getClassDescriptor(oid.getObjectsTopLevelClass()); FieldDescriptor[] fields = cld.getPkFields(); Criteria criteria = new Criteria(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fld = fields[i]; criteria.addEqualTo(fld.getAttributeName(), values[i]); } return QueryFactory.newQuery(cld.getClassOfObject(), criteria); }
java
public Query getPKQuery(Identity oid) { Object[] values = oid.getPrimaryKeyValues(); ClassDescriptor cld = pb.getClassDescriptor(oid.getObjectsTopLevelClass()); FieldDescriptor[] fields = cld.getPkFields(); Criteria criteria = new Criteria(); for (int i = 0; i < fields.length; i++) { FieldDescriptor fld = fields[i]; criteria.addEqualTo(fld.getAttributeName(), values[i]); } return QueryFactory.newQuery(cld.getClassOfObject(), criteria); }
[ "public", "Query", "getPKQuery", "(", "Identity", "oid", ")", "{", "Object", "[", "]", "values", "=", "oid", ".", "getPrimaryKeyValues", "(", ")", ";", "ClassDescriptor", "cld", "=", "pb", ".", "getClassDescriptor", "(", "oid", ".", "getObjectsTopLevelClass", "(", ")", ")", ";", "FieldDescriptor", "[", "]", "fields", "=", "cld", ".", "getPkFields", "(", ")", ";", "Criteria", "criteria", "=", "new", "Criteria", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "FieldDescriptor", "fld", "=", "fields", "[", "i", "]", ";", "criteria", ".", "addEqualTo", "(", "fld", ".", "getAttributeName", "(", ")", ",", "values", "[", "i", "]", ")", ";", "}", "return", "QueryFactory", ".", "newQuery", "(", "cld", ".", "getClassOfObject", "(", ")", ",", "criteria", ")", ";", "}" ]
Answer the primary key query to retrieve an Object @param oid the Identity of the Object to retrieve @return The resulting query
[ "Answer", "the", "primary", "key", "query", "to", "retrieve", "an", "Object" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L915-L928
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveCollections
public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, false); }
java
public void retrieveCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, false); }
[ "public", "void", "retrieveCollections", "(", "Object", "newObj", ",", "ClassDescriptor", "cld", ",", "boolean", "forced", ")", "throws", "PersistenceBrokerException", "{", "doRetrieveCollections", "(", "newObj", ",", "cld", ",", "forced", ",", "false", ")", ";", "}" ]
Retrieve all Collection attributes of a given instance @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true, loading is forced even if cld differs
[ "Retrieve", "all", "Collection", "attributes", "of", "a", "given", "instance" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L938-L941
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveProxyCollections
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, true); }
java
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, true); }
[ "public", "void", "retrieveProxyCollections", "(", "Object", "newObj", ",", "ClassDescriptor", "cld", ",", "boolean", "forced", ")", "throws", "PersistenceBrokerException", "{", "doRetrieveCollections", "(", "newObj", ",", "cld", ",", "forced", ",", "true", ")", ";", "}" ]
Retrieve all Collection attributes of a given instance, and make all of the Proxy Collections @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true, loading is forced even if cld differs
[ "Retrieve", "all", "Collection", "attributes", "of", "a", "given", "instance", "and", "make", "all", "of", "the", "Proxy", "Collections" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L951-L954
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.removePrefetchingListeners
public void removePrefetchingListeners() { if (prefetchingListeners != null) { for (Iterator it = prefetchingListeners.iterator(); it.hasNext(); ) { PBPrefetchingListener listener = (PBPrefetchingListener) it.next(); listener.removeThisListener(); } prefetchingListeners.clear(); } }
java
public void removePrefetchingListeners() { if (prefetchingListeners != null) { for (Iterator it = prefetchingListeners.iterator(); it.hasNext(); ) { PBPrefetchingListener listener = (PBPrefetchingListener) it.next(); listener.removeThisListener(); } prefetchingListeners.clear(); } }
[ "public", "void", "removePrefetchingListeners", "(", ")", "{", "if", "(", "prefetchingListeners", "!=", "null", ")", "{", "for", "(", "Iterator", "it", "=", "prefetchingListeners", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "PBPrefetchingListener", "listener", "=", "(", "PBPrefetchingListener", ")", "it", ".", "next", "(", ")", ";", "listener", ".", "removeThisListener", "(", ")", ";", "}", "prefetchingListeners", ".", "clear", "(", ")", ";", "}", "}" ]
remove all prefetching listeners
[ "remove", "all", "prefetching", "listeners" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L993-L1004
train
geomajas/geomajas-project-server
plugin/cache/cache-infinispan/src/main/java/org/geomajas/plugin/caching/infinispan/cache/InfinispanCacheFactory.java
InfinispanCacheFactory.init
@PostConstruct protected void init() throws IOException { // base configuration from XML file if (null != configurationFile) { log.debug("Get base configuration from {}", configurationFile); manager = new DefaultCacheManager(configurationFile); } else { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); builder.globalJmxStatistics().allowDuplicateDomains(true); manager = new DefaultCacheManager(builder.build()); } if (listener == null) { listener = new InfinispanCacheListener(); } manager.addListener(listener); // cache for caching the cache configurations (hmmm, sounds a bit strange) Map<String, Map<CacheCategory, CacheService>> cacheCache = new HashMap<String, Map<CacheCategory, CacheService>>(); // build default configuration if (null != defaultConfiguration) { setCaches(cacheCache, null, defaultConfiguration); } // build layer specific configurations for (Layer layer : layerMap.values()) { CacheInfo ci = configurationService.getLayerExtraInfo(layer.getLayerInfo(), CacheInfo.class); if (null != ci) { setCaches(cacheCache, layer, ci); } } }
java
@PostConstruct protected void init() throws IOException { // base configuration from XML file if (null != configurationFile) { log.debug("Get base configuration from {}", configurationFile); manager = new DefaultCacheManager(configurationFile); } else { GlobalConfigurationBuilder builder = new GlobalConfigurationBuilder(); builder.globalJmxStatistics().allowDuplicateDomains(true); manager = new DefaultCacheManager(builder.build()); } if (listener == null) { listener = new InfinispanCacheListener(); } manager.addListener(listener); // cache for caching the cache configurations (hmmm, sounds a bit strange) Map<String, Map<CacheCategory, CacheService>> cacheCache = new HashMap<String, Map<CacheCategory, CacheService>>(); // build default configuration if (null != defaultConfiguration) { setCaches(cacheCache, null, defaultConfiguration); } // build layer specific configurations for (Layer layer : layerMap.values()) { CacheInfo ci = configurationService.getLayerExtraInfo(layer.getLayerInfo(), CacheInfo.class); if (null != ci) { setCaches(cacheCache, layer, ci); } } }
[ "@", "PostConstruct", "protected", "void", "init", "(", ")", "throws", "IOException", "{", "// base configuration from XML file", "if", "(", "null", "!=", "configurationFile", ")", "{", "log", ".", "debug", "(", "\"Get base configuration from {}\"", ",", "configurationFile", ")", ";", "manager", "=", "new", "DefaultCacheManager", "(", "configurationFile", ")", ";", "}", "else", "{", "GlobalConfigurationBuilder", "builder", "=", "new", "GlobalConfigurationBuilder", "(", ")", ";", "builder", ".", "globalJmxStatistics", "(", ")", ".", "allowDuplicateDomains", "(", "true", ")", ";", "manager", "=", "new", "DefaultCacheManager", "(", "builder", ".", "build", "(", ")", ")", ";", "}", "if", "(", "listener", "==", "null", ")", "{", "listener", "=", "new", "InfinispanCacheListener", "(", ")", ";", "}", "manager", ".", "addListener", "(", "listener", ")", ";", "// cache for caching the cache configurations (hmmm, sounds a bit strange)", "Map", "<", "String", ",", "Map", "<", "CacheCategory", ",", "CacheService", ">", ">", "cacheCache", "=", "new", "HashMap", "<", "String", ",", "Map", "<", "CacheCategory", ",", "CacheService", ">", ">", "(", ")", ";", "// build default configuration", "if", "(", "null", "!=", "defaultConfiguration", ")", "{", "setCaches", "(", "cacheCache", ",", "null", ",", "defaultConfiguration", ")", ";", "}", "// build layer specific configurations", "for", "(", "Layer", "layer", ":", "layerMap", ".", "values", "(", ")", ")", "{", "CacheInfo", "ci", "=", "configurationService", ".", "getLayerExtraInfo", "(", "layer", ".", "getLayerInfo", "(", ")", ",", "CacheInfo", ".", "class", ")", ";", "if", "(", "null", "!=", "ci", ")", "{", "setCaches", "(", "cacheCache", ",", "layer", ",", "ci", ")", ";", "}", "}", "}" ]
Finish initializing service. @throws IOException oop
[ "Finish", "initializing", "service", "." ]
904b7d7deed1350d28955589098dd1e0a786d76e
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/cache/cache-infinispan/src/main/java/org/geomajas/plugin/caching/infinispan/cache/InfinispanCacheFactory.java#L112-L145
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/SearchFilter.java
SearchFilter.ConvertBinaryOperator
protected static String ConvertBinaryOperator(int oper) { // Convert the operator into the proper string String oper_string; switch (oper) { default: case EQUAL: oper_string = "="; break; case LIKE: oper_string = "LIKE"; break; case NOT_EQUAL: oper_string = "!="; break; case LESS_THAN: oper_string = "<"; break; case GREATER_THAN: oper_string = ">"; break; case GREATER_EQUAL: oper_string = ">="; break; case LESS_EQUAL: oper_string = "<="; break; } return oper_string; }
java
protected static String ConvertBinaryOperator(int oper) { // Convert the operator into the proper string String oper_string; switch (oper) { default: case EQUAL: oper_string = "="; break; case LIKE: oper_string = "LIKE"; break; case NOT_EQUAL: oper_string = "!="; break; case LESS_THAN: oper_string = "<"; break; case GREATER_THAN: oper_string = ">"; break; case GREATER_EQUAL: oper_string = ">="; break; case LESS_EQUAL: oper_string = "<="; break; } return oper_string; }
[ "protected", "static", "String", "ConvertBinaryOperator", "(", "int", "oper", ")", "{", "// Convert the operator into the proper string\r", "String", "oper_string", ";", "switch", "(", "oper", ")", "{", "default", ":", "case", "EQUAL", ":", "oper_string", "=", "\"=\"", ";", "break", ";", "case", "LIKE", ":", "oper_string", "=", "\"LIKE\"", ";", "break", ";", "case", "NOT_EQUAL", ":", "oper_string", "=", "\"!=\"", ";", "break", ";", "case", "LESS_THAN", ":", "oper_string", "=", "\"<\"", ";", "break", ";", "case", "GREATER_THAN", ":", "oper_string", "=", "\">\"", ";", "break", ";", "case", "GREATER_EQUAL", ":", "oper_string", "=", "\">=\"", ";", "break", ";", "case", "LESS_EQUAL", ":", "oper_string", "=", "\"<=\"", ";", "break", ";", "}", "return", "oper_string", ";", "}" ]
Static method to convert a binary operator into a string. @param oper is the binary comparison operator to be converted
[ "Static", "method", "to", "convert", "a", "binary", "operator", "into", "a", "string", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L345-L375
train
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java
PointWriter.writeObject
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { document.writeElement("vml:shape", asChild); Point p = (Point) o; String adj = document.getFormatter().format(p.getX()) + "," + document.getFormatter().format(p.getY()); document.writeAttribute("adj", adj); }
java
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { document.writeElement("vml:shape", asChild); Point p = (Point) o; String adj = document.getFormatter().format(p.getX()) + "," + document.getFormatter().format(p.getY()); document.writeAttribute("adj", adj); }
[ "public", "void", "writeObject", "(", "Object", "o", ",", "GraphicsDocument", "document", ",", "boolean", "asChild", ")", "throws", "RenderException", "{", "document", ".", "writeElement", "(", "\"vml:shape\"", ",", "asChild", ")", ";", "Point", "p", "=", "(", "Point", ")", "o", ";", "String", "adj", "=", "document", ".", "getFormatter", "(", ")", ".", "format", "(", "p", ".", "getX", "(", ")", ")", "+", "\",\"", "+", "document", ".", "getFormatter", "(", ")", ".", "format", "(", "p", ".", "getY", "(", ")", ")", ";", "document", ".", "writeAttribute", "(", "\"adj\"", ",", "adj", ")", ";", "}" ]
Writes the object to the specified document, optionally creating a child element. The object in this case should be a point. @param o the object (of type Point). @param document the document to write to. @param asChild create child element if true. @throws RenderException
[ "Writes", "the", "object", "to", "the", "specified", "document", "optionally", "creating", "a", "child", "element", ".", "The", "object", "in", "this", "case", "should", "be", "a", "point", "." ]
904b7d7deed1350d28955589098dd1e0a786d76e
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java#L38-L44
train
kuali/ojb-1.0.4
src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java
DatabaseMetaDataTreeModel.setStatusBarMessage
public void setStatusBarMessage(final String message) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==StatusMessageListener.class) { ((StatusMessageListener)listeners[i+1]).statusMessageReceived(message); } } }
java
public void setStatusBarMessage(final String message) { // Guaranteed to return a non-null array Object[] listeners = listenerList.getListenerList(); // Process the listeners last to first, notifying // those that are interested in this event for (int i = listeners.length-2; i>=0; i-=2) { if (listeners[i]==StatusMessageListener.class) { ((StatusMessageListener)listeners[i+1]).statusMessageReceived(message); } } }
[ "public", "void", "setStatusBarMessage", "(", "final", "String", "message", ")", "{", "// Guaranteed to return a non-null array\r", "Object", "[", "]", "listeners", "=", "listenerList", ".", "getListenerList", "(", ")", ";", "// Process the listeners last to first, notifying\r", "// those that are interested in this event\r", "for", "(", "int", "i", "=", "listeners", ".", "length", "-", "2", ";", "i", ">=", "0", ";", "i", "-=", "2", ")", "{", "if", "(", "listeners", "[", "i", "]", "==", "StatusMessageListener", ".", "class", ")", "{", "(", "(", "StatusMessageListener", ")", "listeners", "[", "i", "+", "1", "]", ")", ".", "statusMessageReceived", "(", "message", ")", ";", "}", "}", "}" ]
Set a status message in the JTextComponent passed to this model. @param message The message that should be displayed.
[ "Set", "a", "status", "message", "in", "the", "JTextComponent", "passed", "to", "this", "model", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java#L55-L67
train
kuali/ojb-1.0.4
src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java
DatabaseMetaDataTreeModel.reportSqlError
public void reportSqlError(String message, java.sql.SQLException sqlEx) { StringBuffer strBufMessages = new StringBuffer(); java.sql.SQLException currentSqlEx = sqlEx; do { strBufMessages.append("\n" + sqlEx.getErrorCode() + ":" + sqlEx.getMessage()); currentSqlEx = currentSqlEx.getNextException(); } while (currentSqlEx != null); System.err.println(message + strBufMessages.toString()); sqlEx.printStackTrace(); }
java
public void reportSqlError(String message, java.sql.SQLException sqlEx) { StringBuffer strBufMessages = new StringBuffer(); java.sql.SQLException currentSqlEx = sqlEx; do { strBufMessages.append("\n" + sqlEx.getErrorCode() + ":" + sqlEx.getMessage()); currentSqlEx = currentSqlEx.getNextException(); } while (currentSqlEx != null); System.err.println(message + strBufMessages.toString()); sqlEx.printStackTrace(); }
[ "public", "void", "reportSqlError", "(", "String", "message", ",", "java", ".", "sql", ".", "SQLException", "sqlEx", ")", "{", "StringBuffer", "strBufMessages", "=", "new", "StringBuffer", "(", ")", ";", "java", ".", "sql", ".", "SQLException", "currentSqlEx", "=", "sqlEx", ";", "do", "{", "strBufMessages", ".", "append", "(", "\"\\n\"", "+", "sqlEx", ".", "getErrorCode", "(", ")", "+", "\":\"", "+", "sqlEx", ".", "getMessage", "(", ")", ")", ";", "currentSqlEx", "=", "currentSqlEx", ".", "getNextException", "(", ")", ";", "}", "while", "(", "currentSqlEx", "!=", "null", ")", ";", "System", ".", "err", ".", "println", "(", "message", "+", "strBufMessages", ".", "toString", "(", ")", ")", ";", "sqlEx", ".", "printStackTrace", "(", ")", ";", "}" ]
Method for reporting SQLException. This is used by the treenodes if retrieving information for a node is not successful. @param message The message describing where the error occurred @param sqlEx The exception to be reported.
[ "Method", "for", "reporting", "SQLException", ".", "This", "is", "used", "by", "the", "treenodes", "if", "retrieving", "information", "for", "a", "node", "is", "not", "successful", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/tools/org/apache/ojb/tools/mapping/reversedb2/dbmetatreemodel/DatabaseMetaDataTreeModel.java#L93-L104
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java
MetadataObjectCopyStrategy.copy
public Object copy(final Object obj, final PersistenceBroker broker) { return clone(obj, IdentityMapFactory.getIdentityMap(), broker); }
java
public Object copy(final Object obj, final PersistenceBroker broker) { return clone(obj, IdentityMapFactory.getIdentityMap(), broker); }
[ "public", "Object", "copy", "(", "final", "Object", "obj", ",", "final", "PersistenceBroker", "broker", ")", "{", "return", "clone", "(", "obj", ",", "IdentityMapFactory", ".", "getIdentityMap", "(", ")", ",", "broker", ")", ";", "}" ]
Uses an IdentityMap to make sure we don't recurse infinitely on the same object in a cyclic object model. Proxies @param obj @return
[ "Uses", "an", "IdentityMap", "to", "make", "sure", "we", "don", "t", "recurse", "infinitely", "on", "the", "same", "object", "in", "a", "cyclic", "object", "model", ".", "Proxies" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/otm/copy/MetadataObjectCopyStrategy.java#L48-L51
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/SqlBasedRsIterator.java
SqlBasedRsIterator.getObjectFromResultSet
protected Object getObjectFromResultSet() throws PersistenceBrokerException { try { // if all primitive attributes of the object are contained in the ResultSet // the fast direct mapping can be used return super.getObjectFromResultSet(); } // if the full loading failed we assume that at least PK attributes are contained // in the ResultSet and perform a slower Identity based loading... // This may of course also fail and can throw another PersistenceBrokerException catch (PersistenceBrokerException e) { Identity oid = getIdentityFromResultSet(); return getBroker().getObjectByIdentity(oid); } }
java
protected Object getObjectFromResultSet() throws PersistenceBrokerException { try { // if all primitive attributes of the object are contained in the ResultSet // the fast direct mapping can be used return super.getObjectFromResultSet(); } // if the full loading failed we assume that at least PK attributes are contained // in the ResultSet and perform a slower Identity based loading... // This may of course also fail and can throw another PersistenceBrokerException catch (PersistenceBrokerException e) { Identity oid = getIdentityFromResultSet(); return getBroker().getObjectByIdentity(oid); } }
[ "protected", "Object", "getObjectFromResultSet", "(", ")", "throws", "PersistenceBrokerException", "{", "try", "{", "// if all primitive attributes of the object are contained in the ResultSet\r", "// the fast direct mapping can be used\r", "return", "super", ".", "getObjectFromResultSet", "(", ")", ";", "}", "// if the full loading failed we assume that at least PK attributes are contained\r", "// in the ResultSet and perform a slower Identity based loading...\r", "// This may of course also fail and can throw another PersistenceBrokerException\r", "catch", "(", "PersistenceBrokerException", "e", ")", "{", "Identity", "oid", "=", "getIdentityFromResultSet", "(", ")", ";", "return", "getBroker", "(", ")", ".", "getObjectByIdentity", "(", "oid", ")", ";", "}", "}" ]
returns a proxy or a fully materialized Object from the current row of the underlying resultset.
[ "returns", "a", "proxy", "or", "a", "fully", "materialized", "Object", "from", "the", "current", "row", "of", "the", "underlying", "resultset", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/SqlBasedRsIterator.java#L47-L65
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/ant/DataSet.java
DataSet.createInsertionSql
public void createInsertionSql(Database model, Platform platform, Writer writer) throws IOException { for (Iterator it = _beans.iterator(); it.hasNext();) { writer.write(platform.getInsertSql(model, (DynaBean)it.next())); if (it.hasNext()) { writer.write("\n"); } } }
java
public void createInsertionSql(Database model, Platform platform, Writer writer) throws IOException { for (Iterator it = _beans.iterator(); it.hasNext();) { writer.write(platform.getInsertSql(model, (DynaBean)it.next())); if (it.hasNext()) { writer.write("\n"); } } }
[ "public", "void", "createInsertionSql", "(", "Database", "model", ",", "Platform", "platform", ",", "Writer", "writer", ")", "throws", "IOException", "{", "for", "(", "Iterator", "it", "=", "_beans", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "writer", ".", "write", "(", "platform", ".", "getInsertSql", "(", "model", ",", "(", "DynaBean", ")", "it", ".", "next", "(", ")", ")", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "writer", ".", "write", "(", "\"\\n\"", ")", ";", "}", "}", "}" ]
Generates and writes the sql for inserting the currently contained data objects. @param model The database model @param platform The platform @param writer The output stream
[ "Generates", "and", "writes", "the", "sql", "for", "inserting", "the", "currently", "contained", "data", "objects", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/ant/DataSet.java#L55-L65
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/ant/DataSet.java
DataSet.insert
public void insert(Platform platform, Database model, int batchSize) throws SQLException { if (batchSize <= 1) { for (Iterator it = _beans.iterator(); it.hasNext();) { platform.insert(model, (DynaBean)it.next()); } } else { for (int startIdx = 0; startIdx < _beans.size(); startIdx += batchSize) { platform.insert(model, _beans.subList(startIdx, startIdx + batchSize)); } } }
java
public void insert(Platform platform, Database model, int batchSize) throws SQLException { if (batchSize <= 1) { for (Iterator it = _beans.iterator(); it.hasNext();) { platform.insert(model, (DynaBean)it.next()); } } else { for (int startIdx = 0; startIdx < _beans.size(); startIdx += batchSize) { platform.insert(model, _beans.subList(startIdx, startIdx + batchSize)); } } }
[ "public", "void", "insert", "(", "Platform", "platform", ",", "Database", "model", ",", "int", "batchSize", ")", "throws", "SQLException", "{", "if", "(", "batchSize", "<=", "1", ")", "{", "for", "(", "Iterator", "it", "=", "_beans", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "platform", ".", "insert", "(", "model", ",", "(", "DynaBean", ")", "it", ".", "next", "(", ")", ")", ";", "}", "}", "else", "{", "for", "(", "int", "startIdx", "=", "0", ";", "startIdx", "<", "_beans", ".", "size", "(", ")", ";", "startIdx", "+=", "batchSize", ")", "{", "platform", ".", "insert", "(", "model", ",", "_beans", ".", "subList", "(", "startIdx", ",", "startIdx", "+", "batchSize", ")", ")", ";", "}", "}", "}" ]
Inserts the currently contained data objects into the database. @param platform The (connected) database platform for inserting data @param model The database model @param batchSize The batch size; use 1 for not using batch mode
[ "Inserts", "the", "currently", "contained", "data", "objects", "into", "the", "database", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/ant/DataSet.java#L74-L90
train
geomajas/geomajas-project-server
plugin/geocoder/geocoder/src/main/java/org/geomajas/plugin/geocoder/service/GeonamesGeocoderService.java
GeonamesGeocoderService.connect
private InputStream connect(String url) throws IOException { URLConnection conn = new URL(URL_BASE + url).openConnection(); conn.setConnectTimeout(CONNECT_TIMEOUT); conn.setReadTimeout(READ_TIMEOUT); conn.setRequestProperty("User-Agent", USER_AGENT); return conn.getInputStream(); }
java
private InputStream connect(String url) throws IOException { URLConnection conn = new URL(URL_BASE + url).openConnection(); conn.setConnectTimeout(CONNECT_TIMEOUT); conn.setReadTimeout(READ_TIMEOUT); conn.setRequestProperty("User-Agent", USER_AGENT); return conn.getInputStream(); }
[ "private", "InputStream", "connect", "(", "String", "url", ")", "throws", "IOException", "{", "URLConnection", "conn", "=", "new", "URL", "(", "URL_BASE", "+", "url", ")", ".", "openConnection", "(", ")", ";", "conn", ".", "setConnectTimeout", "(", "CONNECT_TIMEOUT", ")", ";", "conn", ".", "setReadTimeout", "(", "READ_TIMEOUT", ")", ";", "conn", ".", "setRequestProperty", "(", "\"User-Agent\"", ",", "USER_AGENT", ")", ";", "return", "conn", ".", "getInputStream", "(", ")", ";", "}" ]
Open the connection to the server. @param url the url to connect to @return returns the input stream for the connection @throws IOException cannot get result
[ "Open", "the", "connection", "to", "the", "server", "." ]
904b7d7deed1350d28955589098dd1e0a786d76e
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/geocoder/geocoder/src/main/java/org/geomajas/plugin/geocoder/service/GeonamesGeocoderService.java#L254-L260
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.abortTransaction
public synchronized void abortTransaction() throws TransactionNotInProgressException { if(isInTransaction()) { fireBrokerEvent(BEFORE_ROLLBACK_EVENT); setInTransaction(false); clearRegistrationLists(); referencesBroker.removePrefetchingListeners(); /* arminw: check if we in local tx, before do local rollback Necessary, because ConnectionManager may do a rollback by itself or in managed environments the used connection is already be closed */ if(connectionManager.isInLocalTransaction()) this.connectionManager.localRollback(); fireBrokerEvent(AFTER_ROLLBACK_EVENT); } }
java
public synchronized void abortTransaction() throws TransactionNotInProgressException { if(isInTransaction()) { fireBrokerEvent(BEFORE_ROLLBACK_EVENT); setInTransaction(false); clearRegistrationLists(); referencesBroker.removePrefetchingListeners(); /* arminw: check if we in local tx, before do local rollback Necessary, because ConnectionManager may do a rollback by itself or in managed environments the used connection is already be closed */ if(connectionManager.isInLocalTransaction()) this.connectionManager.localRollback(); fireBrokerEvent(AFTER_ROLLBACK_EVENT); } }
[ "public", "synchronized", "void", "abortTransaction", "(", ")", "throws", "TransactionNotInProgressException", "{", "if", "(", "isInTransaction", "(", ")", ")", "{", "fireBrokerEvent", "(", "BEFORE_ROLLBACK_EVENT", ")", ";", "setInTransaction", "(", "false", ")", ";", "clearRegistrationLists", "(", ")", ";", "referencesBroker", ".", "removePrefetchingListeners", "(", ")", ";", "/*\n arminw:\n check if we in local tx, before do local rollback\n Necessary, because ConnectionManager may do a rollback by itself\n or in managed environments the used connection is already be closed\n */", "if", "(", "connectionManager", ".", "isInLocalTransaction", "(", ")", ")", "this", ".", "connectionManager", ".", "localRollback", "(", ")", ";", "fireBrokerEvent", "(", "AFTER_ROLLBACK_EVENT", ")", ";", "}", "}" ]
Abort and close the transaction. Calling abort abandons all persistent object modifications and releases the associated locks. If transaction is not in progress a TransactionNotInProgressException is thrown
[ "Abort", "and", "close", "the", "transaction", ".", "Calling", "abort", "abandons", "all", "persistent", "object", "modifications", "and", "releases", "the", "associated", "locks", ".", "If", "transaction", "is", "not", "in", "progress", "a", "TransactionNotInProgressException", "is", "thrown" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L408-L425
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.delete
public void delete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { if(isTxCheck() && !isInTransaction()) { if(logger.isEnabledFor(Logger.ERROR)) { String msg = "No running PB-tx found. Please, only delete objects in context of a PB-transaction" + " to avoid side-effects - e.g. when rollback of complex objects."; try { throw new Exception("** Delete object without active PersistenceBroker transaction **"); } catch(Exception e) { logger.error(msg, e); } } } try { doDelete(obj, ignoreReferences); } finally { markedForDelete.clear(); } }
java
public void delete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { if(isTxCheck() && !isInTransaction()) { if(logger.isEnabledFor(Logger.ERROR)) { String msg = "No running PB-tx found. Please, only delete objects in context of a PB-transaction" + " to avoid side-effects - e.g. when rollback of complex objects."; try { throw new Exception("** Delete object without active PersistenceBroker transaction **"); } catch(Exception e) { logger.error(msg, e); } } } try { doDelete(obj, ignoreReferences); } finally { markedForDelete.clear(); } }
[ "public", "void", "delete", "(", "Object", "obj", ",", "boolean", "ignoreReferences", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "isTxCheck", "(", ")", "&&", "!", "isInTransaction", "(", ")", ")", "{", "if", "(", "logger", ".", "isEnabledFor", "(", "Logger", ".", "ERROR", ")", ")", "{", "String", "msg", "=", "\"No running PB-tx found. Please, only delete objects in context of a PB-transaction\"", "+", "\" to avoid side-effects - e.g. when rollback of complex objects.\"", ";", "try", "{", "throw", "new", "Exception", "(", "\"** Delete object without active PersistenceBroker transaction **\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "msg", ",", "e", ")", ";", "}", "}", "}", "try", "{", "doDelete", "(", "obj", ",", "ignoreReferences", ")", ";", "}", "finally", "{", "markedForDelete", ".", "clear", "(", ")", ";", "}", "}" ]
Deletes the concrete representation of the specified object in the underlying persistence system. This method is intended for use in top-level api or by internal calls. @param obj The object to delete. @param ignoreReferences With this flag the automatic deletion/unlinking of references can be suppressed (independent of the used auto-delete setting in metadata), except {@link org.apache.ojb.broker.metadata.SuperReferenceDescriptor} these kind of reference (descriptor) will always be performed. If <em>true</em> all "normal" referenced objects will be ignored, only the specified object is handled. @throws PersistenceBrokerException
[ "Deletes", "the", "concrete", "representation", "of", "the", "specified", "object", "in", "the", "underlying", "persistence", "system", ".", "This", "method", "is", "intended", "for", "use", "in", "top", "-", "level", "api", "or", "by", "internal", "calls", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L492-L518
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.doDelete
private void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { //logger.info("DELETING " + obj); // object is not null if (obj != null) { obj = getProxyFactory().getRealObject(obj); /** * Kuali Foundation modification -- 8/24/2007 */ if ( obj == null ) return; /** * End of Kuali Foundation modification */ /** * MBAIRD * 1. if we are marked for delete already, avoid recursing on this object * * arminw: * use object instead Identity object in markedForDelete List, * because using objects we get a better performance. I can't find * side-effects in doing so. */ if (markedForDelete.contains(obj)) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); //BRJ: check for valid pk if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj)) { String msg = "Cannot delete object without valid PKs. " + obj; logger.error(msg); return; } /** * MBAIRD * 2. register object in markedForDelete map. */ markedForDelete.add(obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); // Invoke events on PersistenceBrokerAware instances and listeners BEFORE_DELETE_EVENT.setTarget(obj); fireBrokerEvent(BEFORE_DELETE_EVENT); BEFORE_DELETE_EVENT.setTarget(null); // now perform deletion performDeletion(cld, obj, oid, ignoreReferences); // Invoke events on PersistenceBrokerAware instances and listeners AFTER_DELETE_EVENT.setTarget(obj); fireBrokerEvent(AFTER_DELETE_EVENT); AFTER_DELETE_EVENT.setTarget(null); // let the connection manager to execute batch connectionManager.executeBatchIfNecessary(); } }
java
private void doDelete(Object obj, boolean ignoreReferences) throws PersistenceBrokerException { //logger.info("DELETING " + obj); // object is not null if (obj != null) { obj = getProxyFactory().getRealObject(obj); /** * Kuali Foundation modification -- 8/24/2007 */ if ( obj == null ) return; /** * End of Kuali Foundation modification */ /** * MBAIRD * 1. if we are marked for delete already, avoid recursing on this object * * arminw: * use object instead Identity object in markedForDelete List, * because using objects we get a better performance. I can't find * side-effects in doing so. */ if (markedForDelete.contains(obj)) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); //BRJ: check for valid pk if (!serviceBrokerHelper().assertValidPkForDelete(cld, obj)) { String msg = "Cannot delete object without valid PKs. " + obj; logger.error(msg); return; } /** * MBAIRD * 2. register object in markedForDelete map. */ markedForDelete.add(obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); // Invoke events on PersistenceBrokerAware instances and listeners BEFORE_DELETE_EVENT.setTarget(obj); fireBrokerEvent(BEFORE_DELETE_EVENT); BEFORE_DELETE_EVENT.setTarget(null); // now perform deletion performDeletion(cld, obj, oid, ignoreReferences); // Invoke events on PersistenceBrokerAware instances and listeners AFTER_DELETE_EVENT.setTarget(obj); fireBrokerEvent(AFTER_DELETE_EVENT); AFTER_DELETE_EVENT.setTarget(null); // let the connection manager to execute batch connectionManager.executeBatchIfNecessary(); } }
[ "private", "void", "doDelete", "(", "Object", "obj", ",", "boolean", "ignoreReferences", ")", "throws", "PersistenceBrokerException", "{", "//logger.info(\"DELETING \" + obj);", "// object is not null", "if", "(", "obj", "!=", "null", ")", "{", "obj", "=", "getProxyFactory", "(", ")", ".", "getRealObject", "(", "obj", ")", ";", "/**\n * Kuali Foundation modification -- 8/24/2007\n */", "if", "(", "obj", "==", "null", ")", "return", ";", "/**\n * End of Kuali Foundation modification\n */", "/**\n * MBAIRD\n * 1. if we are marked for delete already, avoid recursing on this object\n *\n * arminw:\n * use object instead Identity object in markedForDelete List,\n * because using objects we get a better performance. I can't find\n * side-effects in doing so.\n */", "if", "(", "markedForDelete", ".", "contains", "(", "obj", ")", ")", "{", "return", ";", "}", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "obj", ".", "getClass", "(", ")", ")", ";", "//BRJ: check for valid pk", "if", "(", "!", "serviceBrokerHelper", "(", ")", ".", "assertValidPkForDelete", "(", "cld", ",", "obj", ")", ")", "{", "String", "msg", "=", "\"Cannot delete object without valid PKs. \"", "+", "obj", ";", "logger", ".", "error", "(", "msg", ")", ";", "return", ";", "}", "/**\n * MBAIRD\n * 2. register object in markedForDelete map.\n */", "markedForDelete", ".", "add", "(", "obj", ")", ";", "Identity", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "cld", ",", "obj", ")", ";", "// Invoke events on PersistenceBrokerAware instances and listeners", "BEFORE_DELETE_EVENT", ".", "setTarget", "(", "obj", ")", ";", "fireBrokerEvent", "(", "BEFORE_DELETE_EVENT", ")", ";", "BEFORE_DELETE_EVENT", ".", "setTarget", "(", "null", ")", ";", "// now perform deletion", "performDeletion", "(", "cld", ",", "obj", ",", "oid", ",", "ignoreReferences", ")", ";", "// Invoke events on PersistenceBrokerAware instances and listeners", "AFTER_DELETE_EVENT", ".", "setTarget", "(", "obj", ")", ";", "fireBrokerEvent", "(", "AFTER_DELETE_EVENT", ")", ";", "AFTER_DELETE_EVENT", ".", "setTarget", "(", "null", ")", ";", "// let the connection manager to execute batch", "connectionManager", ".", "executeBatchIfNecessary", "(", ")", ";", "}", "}" ]
do delete given object. Should be used by all intern classes to delete objects.
[ "do", "delete", "given", "object", ".", "Should", "be", "used", "by", "all", "intern", "classes", "to", "delete", "objects", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L532-L592
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.deleteByQuery
private void deleteByQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { if (logger.isDebugEnabled()) { logger.debug("deleteByQuery " + cld.getClassNameOfObject() + ", " + query); } if (query instanceof QueryBySQL) { String sql = ((QueryBySQL) query).getSql(); this.dbAccess.executeUpdateSQL(sql, cld); } else { // if query is Identity based transform it to a criteria based query first if (query instanceof QueryByIdentity) { QueryByIdentity qbi = (QueryByIdentity) query; Object oid = qbi.getExampleObject(); // make sure it's an Identity if (!(oid instanceof Identity)) { oid = serviceIdentity().buildIdentity(oid); } query = referencesBroker.getPKQuery((Identity) oid); } if (!cld.isInterface()) { this.dbAccess.executeDelete(query, cld); } // if class is an extent, we have to delete all extent classes too String lastUsedTable = cld.getFullTableName(); if (cld.isExtent()) { Iterator extents = getDescriptorRepository().getAllConcreteSubclassDescriptors(cld).iterator(); while (extents.hasNext()) { ClassDescriptor extCld = (ClassDescriptor) extents.next(); // read same table only once if (!extCld.getFullTableName().equals(lastUsedTable)) { lastUsedTable = extCld.getFullTableName(); this.dbAccess.executeDelete(query, extCld); } } } } }
java
private void deleteByQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { if (logger.isDebugEnabled()) { logger.debug("deleteByQuery " + cld.getClassNameOfObject() + ", " + query); } if (query instanceof QueryBySQL) { String sql = ((QueryBySQL) query).getSql(); this.dbAccess.executeUpdateSQL(sql, cld); } else { // if query is Identity based transform it to a criteria based query first if (query instanceof QueryByIdentity) { QueryByIdentity qbi = (QueryByIdentity) query; Object oid = qbi.getExampleObject(); // make sure it's an Identity if (!(oid instanceof Identity)) { oid = serviceIdentity().buildIdentity(oid); } query = referencesBroker.getPKQuery((Identity) oid); } if (!cld.isInterface()) { this.dbAccess.executeDelete(query, cld); } // if class is an extent, we have to delete all extent classes too String lastUsedTable = cld.getFullTableName(); if (cld.isExtent()) { Iterator extents = getDescriptorRepository().getAllConcreteSubclassDescriptors(cld).iterator(); while (extents.hasNext()) { ClassDescriptor extCld = (ClassDescriptor) extents.next(); // read same table only once if (!extCld.getFullTableName().equals(lastUsedTable)) { lastUsedTable = extCld.getFullTableName(); this.dbAccess.executeDelete(query, extCld); } } } } }
[ "private", "void", "deleteByQuery", "(", "Query", "query", ",", "ClassDescriptor", "cld", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"deleteByQuery \"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\", \"", "+", "query", ")", ";", "}", "if", "(", "query", "instanceof", "QueryBySQL", ")", "{", "String", "sql", "=", "(", "(", "QueryBySQL", ")", "query", ")", ".", "getSql", "(", ")", ";", "this", ".", "dbAccess", ".", "executeUpdateSQL", "(", "sql", ",", "cld", ")", ";", "}", "else", "{", "// if query is Identity based transform it to a criteria based query first", "if", "(", "query", "instanceof", "QueryByIdentity", ")", "{", "QueryByIdentity", "qbi", "=", "(", "QueryByIdentity", ")", "query", ";", "Object", "oid", "=", "qbi", ".", "getExampleObject", "(", ")", ";", "// make sure it's an Identity", "if", "(", "!", "(", "oid", "instanceof", "Identity", ")", ")", "{", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "oid", ")", ";", "}", "query", "=", "referencesBroker", ".", "getPKQuery", "(", "(", "Identity", ")", "oid", ")", ";", "}", "if", "(", "!", "cld", ".", "isInterface", "(", ")", ")", "{", "this", ".", "dbAccess", ".", "executeDelete", "(", "query", ",", "cld", ")", ";", "}", "// if class is an extent, we have to delete all extent classes too", "String", "lastUsedTable", "=", "cld", ".", "getFullTableName", "(", ")", ";", "if", "(", "cld", ".", "isExtent", "(", ")", ")", "{", "Iterator", "extents", "=", "getDescriptorRepository", "(", ")", ".", "getAllConcreteSubclassDescriptors", "(", "cld", ")", ".", "iterator", "(", ")", ";", "while", "(", "extents", ".", "hasNext", "(", ")", ")", "{", "ClassDescriptor", "extCld", "=", "(", "ClassDescriptor", ")", "extents", ".", "next", "(", ")", ";", "// read same table only once", "if", "(", "!", "extCld", ".", "getFullTableName", "(", ")", ".", "equals", "(", "lastUsedTable", ")", ")", "{", "lastUsedTable", "=", "extCld", ".", "getFullTableName", "(", ")", ";", "this", ".", "dbAccess", ".", "executeDelete", "(", "query", ",", "extCld", ")", ";", "}", "}", "}", "}", "}" ]
Extent aware Delete by Query @param query @param cld @throws PersistenceBrokerException
[ "Extent", "aware", "Delete", "by", "Query" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L635-L687
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.store
public void store(Object obj) throws PersistenceBrokerException { obj = extractObjectToStore(obj); // only do something if obj != null if(obj == null) return; ClassDescriptor cld = getClassDescriptor(obj.getClass()); /* if one of the PK fields was null, we assume the objects was new and needs insert */ boolean insert = serviceBrokerHelper().hasNullPKField(cld, obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); /* if PK values are set, lookup cache or db to see whether object needs insert or update */ if (!insert) { insert = objectCache.lookup(oid) == null && !serviceBrokerHelper().doesExist(cld, oid, obj); } store(obj, oid, cld, insert); }
java
public void store(Object obj) throws PersistenceBrokerException { obj = extractObjectToStore(obj); // only do something if obj != null if(obj == null) return; ClassDescriptor cld = getClassDescriptor(obj.getClass()); /* if one of the PK fields was null, we assume the objects was new and needs insert */ boolean insert = serviceBrokerHelper().hasNullPKField(cld, obj); Identity oid = serviceIdentity().buildIdentity(cld, obj); /* if PK values are set, lookup cache or db to see whether object needs insert or update */ if (!insert) { insert = objectCache.lookup(oid) == null && !serviceBrokerHelper().doesExist(cld, oid, obj); } store(obj, oid, cld, insert); }
[ "public", "void", "store", "(", "Object", "obj", ")", "throws", "PersistenceBrokerException", "{", "obj", "=", "extractObjectToStore", "(", "obj", ")", ";", "// only do something if obj != null", "if", "(", "obj", "==", "null", ")", "return", ";", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "obj", ".", "getClass", "(", ")", ")", ";", "/*\n if one of the PK fields was null, we assume the objects\n was new and needs insert\n */", "boolean", "insert", "=", "serviceBrokerHelper", "(", ")", ".", "hasNullPKField", "(", "cld", ",", "obj", ")", ";", "Identity", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "cld", ",", "obj", ")", ";", "/*\n if PK values are set, lookup cache or db to see whether object\n needs insert or update\n */", "if", "(", "!", "insert", ")", "{", "insert", "=", "objectCache", ".", "lookup", "(", "oid", ")", "==", "null", "&&", "!", "serviceBrokerHelper", "(", ")", ".", "doesExist", "(", "cld", ",", "oid", ",", "obj", ")", ";", "}", "store", "(", "obj", ",", "oid", ",", "cld", ",", "insert", ")", ";", "}" ]
Store an Object. @see org.apache.ojb.broker.PersistenceBroker#store(Object)
[ "Store", "an", "Object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L796-L819
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.store
protected void store(Object obj, Identity oid, ClassDescriptor cld, boolean insert) { store(obj, oid, cld, insert, false); }
java
protected void store(Object obj, Identity oid, ClassDescriptor cld, boolean insert) { store(obj, oid, cld, insert, false); }
[ "protected", "void", "store", "(", "Object", "obj", ",", "Identity", "oid", ",", "ClassDescriptor", "cld", ",", "boolean", "insert", ")", "{", "store", "(", "obj", ",", "oid", ",", "cld", ",", "insert", ",", "false", ")", ";", "}" ]
Internal used method which start the real store work.
[ "Internal", "used", "method", "which", "start", "the", "real", "store", "work", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L946-L949
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.link
public void link(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject, boolean insert) { // MBAIRD: we have 'disassociated' this object from the referenced object, // the object represented by the reference descriptor is now null, so set // the fk in the target object to null. // arminw: if an insert was done and ref object was null, we should allow // to pass FK fields of main object (maybe only the FK fields are set) if (referencedObject == null) { /* arminw: if update we set FK fields to 'null', because reference was disassociated We do nothing on insert, maybe only the FK fields of main object (without materialization of the reference object) are set by the user */ if(!insert) { unlinkFK(targetObject, cld, rds); } } else { setFKField(targetObject, cld, rds, referencedObject); } }
java
public void link(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject, boolean insert) { // MBAIRD: we have 'disassociated' this object from the referenced object, // the object represented by the reference descriptor is now null, so set // the fk in the target object to null. // arminw: if an insert was done and ref object was null, we should allow // to pass FK fields of main object (maybe only the FK fields are set) if (referencedObject == null) { /* arminw: if update we set FK fields to 'null', because reference was disassociated We do nothing on insert, maybe only the FK fields of main object (without materialization of the reference object) are set by the user */ if(!insert) { unlinkFK(targetObject, cld, rds); } } else { setFKField(targetObject, cld, rds, referencedObject); } }
[ "public", "void", "link", "(", "Object", "targetObject", ",", "ClassDescriptor", "cld", ",", "ObjectReferenceDescriptor", "rds", ",", "Object", "referencedObject", ",", "boolean", "insert", ")", "{", "// MBAIRD: we have 'disassociated' this object from the referenced object,", "// the object represented by the reference descriptor is now null, so set", "// the fk in the target object to null.", "// arminw: if an insert was done and ref object was null, we should allow", "// to pass FK fields of main object (maybe only the FK fields are set)", "if", "(", "referencedObject", "==", "null", ")", "{", "/*\n arminw:\n if update we set FK fields to 'null', because reference was disassociated\n We do nothing on insert, maybe only the FK fields of main object (without\n materialization of the reference object) are set by the user\n */", "if", "(", "!", "insert", ")", "{", "unlinkFK", "(", "targetObject", ",", "cld", ",", "rds", ")", ";", "}", "}", "else", "{", "setFKField", "(", "targetObject", ",", "cld", ",", "rds", ",", "referencedObject", ")", ";", "}", "}" ]
Assign FK value to target object by reading PK values of referenced object. @param targetObject real (non-proxy) target object @param cld {@link ClassDescriptor} of the real target object @param rds An {@link ObjectReferenceDescriptor} or {@link CollectionDescriptor} associated with the real object. @param referencedObject referenced object or proxy @param insert Show if "linking" is done while insert or update.
[ "Assign", "FK", "value", "to", "target", "object", "by", "reading", "PK", "values", "of", "referenced", "object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1207-L1231
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.unlinkFK
public void unlinkFK(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds) { setFKField(targetObject, cld, rds, null); }
java
public void unlinkFK(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds) { setFKField(targetObject, cld, rds, null); }
[ "public", "void", "unlinkFK", "(", "Object", "targetObject", ",", "ClassDescriptor", "cld", ",", "ObjectReferenceDescriptor", "rds", ")", "{", "setFKField", "(", "targetObject", ",", "cld", ",", "rds", ",", "null", ")", ";", "}" ]
Unkink FK fields of target object. @param targetObject real (non-proxy) target object @param cld {@link ClassDescriptor} of the real target object @param rds An {@link ObjectReferenceDescriptor} or {@link CollectionDescriptor} associated with the real object.
[ "Unkink", "FK", "fields", "of", "target", "object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1241-L1244
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.linkOneToOne
public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert) { storeAndLinkOneToOne(true, obj, cld, rds, true); }
java
public void linkOneToOne(Object obj, ClassDescriptor cld, ObjectReferenceDescriptor rds, boolean insert) { storeAndLinkOneToOne(true, obj, cld, rds, true); }
[ "public", "void", "linkOneToOne", "(", "Object", "obj", ",", "ClassDescriptor", "cld", ",", "ObjectReferenceDescriptor", "rds", ",", "boolean", "insert", ")", "{", "storeAndLinkOneToOne", "(", "true", ",", "obj", ",", "cld", ",", "rds", ",", "true", ")", ";", "}" ]
Assign FK value of main object with PK values of the reference object. @param obj real object with reference (proxy) object (or real object with set FK values on insert) @param cld {@link ClassDescriptor} of the real object @param rds An {@link ObjectReferenceDescriptor} of real object. @param insert Show if "linking" is done while insert or update.
[ "Assign", "FK", "value", "of", "main", "object", "with", "PK", "values", "of", "the", "reference", "object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1299-L1302
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.linkOneToMany
public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert) { Object referencedObjects = cod.getPersistentField().get(obj); storeAndLinkOneToMany(true, obj, cod,referencedObjects, insert); }
java
public void linkOneToMany(Object obj, CollectionDescriptor cod, boolean insert) { Object referencedObjects = cod.getPersistentField().get(obj); storeAndLinkOneToMany(true, obj, cod,referencedObjects, insert); }
[ "public", "void", "linkOneToMany", "(", "Object", "obj", ",", "CollectionDescriptor", "cod", ",", "boolean", "insert", ")", "{", "Object", "referencedObjects", "=", "cod", ".", "getPersistentField", "(", ")", ".", "get", "(", "obj", ")", ";", "storeAndLinkOneToMany", "(", "true", ",", "obj", ",", "cod", ",", "referencedObjects", ",", "insert", ")", ";", "}" ]
Assign FK value to all n-side objects referenced by given object. @param obj real object with 1:n reference @param cod {@link CollectionDescriptor} of referenced 1:n objects @param insert flag signal insert operation, false signals update operation
[ "Assign", "FK", "value", "to", "all", "n", "-", "side", "objects", "referenced", "by", "given", "object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1311-L1315
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.linkMtoN
public void linkMtoN(Object obj, CollectionDescriptor cod, boolean insert) { Object referencedObjects = cod.getPersistentField().get(obj); storeAndLinkMtoN(true, obj, cod, referencedObjects, insert); }
java
public void linkMtoN(Object obj, CollectionDescriptor cod, boolean insert) { Object referencedObjects = cod.getPersistentField().get(obj); storeAndLinkMtoN(true, obj, cod, referencedObjects, insert); }
[ "public", "void", "linkMtoN", "(", "Object", "obj", ",", "CollectionDescriptor", "cod", ",", "boolean", "insert", ")", "{", "Object", "referencedObjects", "=", "cod", ".", "getPersistentField", "(", ")", ".", "get", "(", "obj", ")", ";", "storeAndLinkMtoN", "(", "true", ",", "obj", ",", "cod", ",", "referencedObjects", ",", "insert", ")", ";", "}" ]
Assign FK values and store entries in indirection table for all objects referenced by given object. @param obj real object with 1:n reference @param cod {@link CollectionDescriptor} of referenced 1:n objects @param insert flag signal insert operation, false signals update operation
[ "Assign", "FK", "values", "and", "store", "entries", "in", "indirection", "table", "for", "all", "objects", "referenced", "by", "given", "object", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1325-L1329
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.retrieveReference
public void retrieveReference(Object pInstance, String pAttributeName) throws PersistenceBrokerException { if (logger.isDebugEnabled()) { logger.debug("Retrieving reference named ["+pAttributeName+"] on object of type ["+ pInstance.getClass().getName()+"]"); } ClassDescriptor cld = getClassDescriptor(pInstance.getClass()); CollectionDescriptor cod = cld.getCollectionDescriptorByName(pAttributeName); getInternalCache().enableMaterializationCache(); // to avoid problems with circular references, locally cache the current object instance Identity oid = serviceIdentity().buildIdentity(pInstance); boolean needLocalRemove = false; if(getInternalCache().doLocalLookup(oid) == null) { getInternalCache().doInternalCache(oid, pInstance, MaterializationCache.TYPE_TEMP); needLocalRemove = true; } try { if (cod != null) { referencesBroker.retrieveCollection(pInstance, cld, cod, true); } else { ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(pAttributeName); if (ord != null) { referencesBroker.retrieveReference(pInstance, cld, ord, true); } else { throw new PersistenceBrokerException("did not find attribute " + pAttributeName + " for class " + pInstance.getClass().getName()); } } // do locally remove the object to avoid problems with object state detection (insert/update), // because objects found in the cache detected as 'old' means 'update' if(needLocalRemove) getInternalCache().doLocalRemove(oid); getInternalCache().disableMaterializationCache(); } catch(RuntimeException e) { getInternalCache().doLocalClear(); throw e; } }
java
public void retrieveReference(Object pInstance, String pAttributeName) throws PersistenceBrokerException { if (logger.isDebugEnabled()) { logger.debug("Retrieving reference named ["+pAttributeName+"] on object of type ["+ pInstance.getClass().getName()+"]"); } ClassDescriptor cld = getClassDescriptor(pInstance.getClass()); CollectionDescriptor cod = cld.getCollectionDescriptorByName(pAttributeName); getInternalCache().enableMaterializationCache(); // to avoid problems with circular references, locally cache the current object instance Identity oid = serviceIdentity().buildIdentity(pInstance); boolean needLocalRemove = false; if(getInternalCache().doLocalLookup(oid) == null) { getInternalCache().doInternalCache(oid, pInstance, MaterializationCache.TYPE_TEMP); needLocalRemove = true; } try { if (cod != null) { referencesBroker.retrieveCollection(pInstance, cld, cod, true); } else { ObjectReferenceDescriptor ord = cld.getObjectReferenceDescriptorByName(pAttributeName); if (ord != null) { referencesBroker.retrieveReference(pInstance, cld, ord, true); } else { throw new PersistenceBrokerException("did not find attribute " + pAttributeName + " for class " + pInstance.getClass().getName()); } } // do locally remove the object to avoid problems with object state detection (insert/update), // because objects found in the cache detected as 'old' means 'update' if(needLocalRemove) getInternalCache().doLocalRemove(oid); getInternalCache().disableMaterializationCache(); } catch(RuntimeException e) { getInternalCache().doLocalClear(); throw e; } }
[ "public", "void", "retrieveReference", "(", "Object", "pInstance", ",", "String", "pAttributeName", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Retrieving reference named [\"", "+", "pAttributeName", "+", "\"] on object of type [\"", "+", "pInstance", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"]\"", ")", ";", "}", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "pInstance", ".", "getClass", "(", ")", ")", ";", "CollectionDescriptor", "cod", "=", "cld", ".", "getCollectionDescriptorByName", "(", "pAttributeName", ")", ";", "getInternalCache", "(", ")", ".", "enableMaterializationCache", "(", ")", ";", "// to avoid problems with circular references, locally cache the current object instance", "Identity", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "pInstance", ")", ";", "boolean", "needLocalRemove", "=", "false", ";", "if", "(", "getInternalCache", "(", ")", ".", "doLocalLookup", "(", "oid", ")", "==", "null", ")", "{", "getInternalCache", "(", ")", ".", "doInternalCache", "(", "oid", ",", "pInstance", ",", "MaterializationCache", ".", "TYPE_TEMP", ")", ";", "needLocalRemove", "=", "true", ";", "}", "try", "{", "if", "(", "cod", "!=", "null", ")", "{", "referencesBroker", ".", "retrieveCollection", "(", "pInstance", ",", "cld", ",", "cod", ",", "true", ")", ";", "}", "else", "{", "ObjectReferenceDescriptor", "ord", "=", "cld", ".", "getObjectReferenceDescriptorByName", "(", "pAttributeName", ")", ";", "if", "(", "ord", "!=", "null", ")", "{", "referencesBroker", ".", "retrieveReference", "(", "pInstance", ",", "cld", ",", "ord", ",", "true", ")", ";", "}", "else", "{", "throw", "new", "PersistenceBrokerException", "(", "\"did not find attribute \"", "+", "pAttributeName", "+", "\" for class \"", "+", "pInstance", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "// do locally remove the object to avoid problems with object state detection (insert/update),", "// because objects found in the cache detected as 'old' means 'update'", "if", "(", "needLocalRemove", ")", "getInternalCache", "(", ")", ".", "doLocalRemove", "(", "oid", ")", ";", "getInternalCache", "(", ")", ".", "disableMaterializationCache", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "getInternalCache", "(", ")", ".", "doLocalClear", "(", ")", ";", "throw", "e", ";", "}", "}" ]
retrieve a single reference- or collection attribute of a persistent instance. @param pInstance the persistent instance @param pAttributeName the name of the Attribute to load
[ "retrieve", "a", "single", "reference", "-", "or", "collection", "attribute", "of", "a", "persistent", "instance", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1399-L1446
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getCollectionByQuery
public ManageableCollection getCollectionByQuery(Class collectionClass, Query query) throws PersistenceBrokerException { return referencesBroker.getCollectionByQuery(collectionClass, query, false); }
java
public ManageableCollection getCollectionByQuery(Class collectionClass, Query query) throws PersistenceBrokerException { return referencesBroker.getCollectionByQuery(collectionClass, query, false); }
[ "public", "ManageableCollection", "getCollectionByQuery", "(", "Class", "collectionClass", ",", "Query", "query", ")", "throws", "PersistenceBrokerException", "{", "return", "referencesBroker", ".", "getCollectionByQuery", "(", "collectionClass", ",", "query", ",", "false", ")", ";", "}" ]
retrieve a collection of type collectionClass matching the Query query @see org.apache.ojb.broker.PersistenceBroker#getCollectionByQuery(Class, Query)
[ "retrieve", "a", "collection", "of", "type", "collectionClass", "matching", "the", "Query", "query" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1513-L1517
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getIteratorFromQuery
protected OJBIterator getIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { RsIteratorFactory factory = RsIteratorFactoryImpl.getInstance(); OJBIterator result = getRsIteratorFromQuery(query, cld, factory); if (query.usePaging()) { result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex()); } return result; }
java
protected OJBIterator getIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { RsIteratorFactory factory = RsIteratorFactoryImpl.getInstance(); OJBIterator result = getRsIteratorFromQuery(query, cld, factory); if (query.usePaging()) { result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex()); } return result; }
[ "protected", "OJBIterator", "getIteratorFromQuery", "(", "Query", "query", ",", "ClassDescriptor", "cld", ")", "throws", "PersistenceBrokerException", "{", "RsIteratorFactory", "factory", "=", "RsIteratorFactoryImpl", ".", "getInstance", "(", ")", ";", "OJBIterator", "result", "=", "getRsIteratorFromQuery", "(", "query", ",", "cld", ",", "factory", ")", ";", "if", "(", "query", ".", "usePaging", "(", ")", ")", "{", "result", "=", "new", "PagingIterator", "(", "result", ",", "query", ".", "getStartAtIndex", "(", ")", ",", "query", ".", "getEndAtIndex", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Get an extent aware Iterator based on the Query @param query @param cld the ClassDescriptor @return OJBIterator
[ "Get", "an", "extent", "aware", "Iterator", "based", "on", "the", "Query" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1665-L1675
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.doGetObjectByIdentity
public Object doGetObjectByIdentity(Identity id) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getObjectByIdentity " + id); // check if object is present in ObjectCache: Object obj = objectCache.lookup(id); // only perform a db lookup if necessary (object not cached yet) if (obj == null) { obj = getDBObject(id); } else { ClassDescriptor cld = getClassDescriptor(obj.getClass()); // if specified in the ClassDescriptor the instance must be refreshed if (cld.isAlwaysRefresh()) { refreshInstance(obj, id, cld); } // now refresh all references checkRefreshRelationships(obj, id, cld); } // Invoke events on PersistenceBrokerAware instances and listeners AFTER_LOOKUP_EVENT.setTarget(obj); fireBrokerEvent(AFTER_LOOKUP_EVENT); AFTER_LOOKUP_EVENT.setTarget(null); //logger.info("RETRIEVING object " + obj); return obj; }
java
public Object doGetObjectByIdentity(Identity id) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getObjectByIdentity " + id); // check if object is present in ObjectCache: Object obj = objectCache.lookup(id); // only perform a db lookup if necessary (object not cached yet) if (obj == null) { obj = getDBObject(id); } else { ClassDescriptor cld = getClassDescriptor(obj.getClass()); // if specified in the ClassDescriptor the instance must be refreshed if (cld.isAlwaysRefresh()) { refreshInstance(obj, id, cld); } // now refresh all references checkRefreshRelationships(obj, id, cld); } // Invoke events on PersistenceBrokerAware instances and listeners AFTER_LOOKUP_EVENT.setTarget(obj); fireBrokerEvent(AFTER_LOOKUP_EVENT); AFTER_LOOKUP_EVENT.setTarget(null); //logger.info("RETRIEVING object " + obj); return obj; }
[ "public", "Object", "doGetObjectByIdentity", "(", "Identity", "id", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"getObjectByIdentity \"", "+", "id", ")", ";", "// check if object is present in ObjectCache:", "Object", "obj", "=", "objectCache", ".", "lookup", "(", "id", ")", ";", "// only perform a db lookup if necessary (object not cached yet)", "if", "(", "obj", "==", "null", ")", "{", "obj", "=", "getDBObject", "(", "id", ")", ";", "}", "else", "{", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "obj", ".", "getClass", "(", ")", ")", ";", "// if specified in the ClassDescriptor the instance must be refreshed", "if", "(", "cld", ".", "isAlwaysRefresh", "(", ")", ")", "{", "refreshInstance", "(", "obj", ",", "id", ",", "cld", ")", ";", "}", "// now refresh all references", "checkRefreshRelationships", "(", "obj", ",", "id", ",", "cld", ")", ";", "}", "// Invoke events on PersistenceBrokerAware instances and listeners", "AFTER_LOOKUP_EVENT", ".", "setTarget", "(", "obj", ")", ";", "fireBrokerEvent", "(", "AFTER_LOOKUP_EVENT", ")", ";", "AFTER_LOOKUP_EVENT", ".", "setTarget", "(", "null", ")", ";", "//logger.info(\"RETRIEVING object \" + obj);", "return", "obj", ";", "}" ]
Internal used method to retrieve object based on Identity. @param id @return @throws PersistenceBrokerException
[ "Internal", "used", "method", "to", "retrieve", "object", "based", "on", "Identity", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1702-L1732
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.refreshInstance
private void refreshInstance(Object cachedInstance, Identity oid, ClassDescriptor cld) { // read in fresh copy from the db, but do not cache it Object freshInstance = getPlainDBObject(cld, oid); // update all primitive typed attributes FieldDescriptor[] fields = cld.getFieldDescriptions(); FieldDescriptor fmd; PersistentField fld; for (int i = 0; i < fields.length; i++) { fmd = fields[i]; fld = fmd.getPersistentField(); fld.set(cachedInstance, fld.get(freshInstance)); } }
java
private void refreshInstance(Object cachedInstance, Identity oid, ClassDescriptor cld) { // read in fresh copy from the db, but do not cache it Object freshInstance = getPlainDBObject(cld, oid); // update all primitive typed attributes FieldDescriptor[] fields = cld.getFieldDescriptions(); FieldDescriptor fmd; PersistentField fld; for (int i = 0; i < fields.length; i++) { fmd = fields[i]; fld = fmd.getPersistentField(); fld.set(cachedInstance, fld.get(freshInstance)); } }
[ "private", "void", "refreshInstance", "(", "Object", "cachedInstance", ",", "Identity", "oid", ",", "ClassDescriptor", "cld", ")", "{", "// read in fresh copy from the db, but do not cache it", "Object", "freshInstance", "=", "getPlainDBObject", "(", "cld", ",", "oid", ")", ";", "// update all primitive typed attributes", "FieldDescriptor", "[", "]", "fields", "=", "cld", ".", "getFieldDescriptions", "(", ")", ";", "FieldDescriptor", "fmd", ";", "PersistentField", "fld", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "fmd", "=", "fields", "[", "i", "]", ";", "fld", "=", "fmd", ".", "getPersistentField", "(", ")", ";", "fld", ".", "set", "(", "cachedInstance", ",", "fld", ".", "get", "(", "freshInstance", ")", ")", ";", "}", "}" ]
refresh all primitive typed attributes of a cached instance with the current values from the database. refreshing of reference and collection attributes is not done here. @param cachedInstance the cached instance to be refreshed @param oid the Identity of the cached instance @param cld the ClassDescriptor of cachedInstance
[ "refresh", "all", "primitive", "typed", "attributes", "of", "a", "cached", "instance", "with", "the", "current", "values", "from", "the", "database", ".", "refreshing", "of", "reference", "and", "collection", "attributes", "is", "not", "done", "here", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1743-L1758
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getObjectByQuery
public Object getObjectByQuery(Query query) throws PersistenceBrokerException { Object result = null; if (query instanceof QueryByIdentity) { // example obj may be an entity or an Identity Object obj = query.getExampleObject(); if (obj instanceof Identity) { Identity oid = (Identity) obj; result = getObjectByIdentity(oid); } else { // TODO: This workaround doesn't allow 'null' for PK fields if (!serviceBrokerHelper().hasNullPKField(getClassDescriptor(obj.getClass()), obj)) { Identity oid = serviceIdentity().buildIdentity(obj); result = getObjectByIdentity(oid); } } } else { Class itemClass = query.getSearchClass(); ClassDescriptor cld = getClassDescriptor(itemClass); /* use OJB intern Iterator, thus we are able to close used resources instantly */ OJBIterator it = getIteratorFromQuery(query, cld); /* arminw: patch by Andre Clute, instead of taking the first found result try to get the first found none null result. He wrote: I have a situation where an item with a certain criteria is in my database twice -- once deleted, and then a non-deleted version of it. When I do a PB.getObjectByQuery(), the RsIterator get's both results from the database, but the first row is the deleted row, so my RowReader filters it out, and do not get the right result. */ try { while (result==null && it.hasNext()) { result = it.next(); } } // make sure that we close the used resources finally { if(it != null) it.releaseDbResources(); } } return result; }
java
public Object getObjectByQuery(Query query) throws PersistenceBrokerException { Object result = null; if (query instanceof QueryByIdentity) { // example obj may be an entity or an Identity Object obj = query.getExampleObject(); if (obj instanceof Identity) { Identity oid = (Identity) obj; result = getObjectByIdentity(oid); } else { // TODO: This workaround doesn't allow 'null' for PK fields if (!serviceBrokerHelper().hasNullPKField(getClassDescriptor(obj.getClass()), obj)) { Identity oid = serviceIdentity().buildIdentity(obj); result = getObjectByIdentity(oid); } } } else { Class itemClass = query.getSearchClass(); ClassDescriptor cld = getClassDescriptor(itemClass); /* use OJB intern Iterator, thus we are able to close used resources instantly */ OJBIterator it = getIteratorFromQuery(query, cld); /* arminw: patch by Andre Clute, instead of taking the first found result try to get the first found none null result. He wrote: I have a situation where an item with a certain criteria is in my database twice -- once deleted, and then a non-deleted version of it. When I do a PB.getObjectByQuery(), the RsIterator get's both results from the database, but the first row is the deleted row, so my RowReader filters it out, and do not get the right result. */ try { while (result==null && it.hasNext()) { result = it.next(); } } // make sure that we close the used resources finally { if(it != null) it.releaseDbResources(); } } return result; }
[ "public", "Object", "getObjectByQuery", "(", "Query", "query", ")", "throws", "PersistenceBrokerException", "{", "Object", "result", "=", "null", ";", "if", "(", "query", "instanceof", "QueryByIdentity", ")", "{", "// example obj may be an entity or an Identity", "Object", "obj", "=", "query", ".", "getExampleObject", "(", ")", ";", "if", "(", "obj", "instanceof", "Identity", ")", "{", "Identity", "oid", "=", "(", "Identity", ")", "obj", ";", "result", "=", "getObjectByIdentity", "(", "oid", ")", ";", "}", "else", "{", "// TODO: This workaround doesn't allow 'null' for PK fields", "if", "(", "!", "serviceBrokerHelper", "(", ")", ".", "hasNullPKField", "(", "getClassDescriptor", "(", "obj", ".", "getClass", "(", ")", ")", ",", "obj", ")", ")", "{", "Identity", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "obj", ")", ";", "result", "=", "getObjectByIdentity", "(", "oid", ")", ";", "}", "}", "}", "else", "{", "Class", "itemClass", "=", "query", ".", "getSearchClass", "(", ")", ";", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "itemClass", ")", ";", "/*\n use OJB intern Iterator, thus we are able to close used\n resources instantly\n */", "OJBIterator", "it", "=", "getIteratorFromQuery", "(", "query", ",", "cld", ")", ";", "/*\n arminw:\n patch by Andre Clute, instead of taking the first found result\n try to get the first found none null result.\n He wrote:\n I have a situation where an item with a certain criteria is in my\n database twice -- once deleted, and then a non-deleted version of it.\n When I do a PB.getObjectByQuery(), the RsIterator get's both results\n from the database, but the first row is the deleted row, so my RowReader\n filters it out, and do not get the right result.\n */", "try", "{", "while", "(", "result", "==", "null", "&&", "it", ".", "hasNext", "(", ")", ")", "{", "result", "=", "it", ".", "next", "(", ")", ";", "}", "}", "// make sure that we close the used resources", "finally", "{", "if", "(", "it", "!=", "null", ")", "it", ".", "releaseDbResources", "(", ")", ";", "}", "}", "return", "result", ";", "}" ]
retrieve an Object by query I.e perform a SELECT ... FROM ... WHERE ... in an RDBMS
[ "retrieve", "an", "Object", "by", "query", "I", ".", "e", "perform", "a", "SELECT", "...", "FROM", "...", "WHERE", "...", "in", "an", "RDBMS" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1764-L1819
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getPKEnumerationByQuery
public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query); query.setFetchSize(1); ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return new PkEnumeration(query, cld, primaryKeyClass, this); }
java
public Enumeration getPKEnumerationByQuery(Class primaryKeyClass, Query query) throws PersistenceBrokerException { if (logger.isDebugEnabled()) logger.debug("getPKEnumerationByQuery " + query); query.setFetchSize(1); ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return new PkEnumeration(query, cld, primaryKeyClass, this); }
[ "public", "Enumeration", "getPKEnumerationByQuery", "(", "Class", "primaryKeyClass", ",", "Query", "query", ")", "throws", "PersistenceBrokerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"getPKEnumerationByQuery \"", "+", "query", ")", ";", "query", ".", "setFetchSize", "(", "1", ")", ";", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "query", ".", "getSearchClass", "(", ")", ")", ";", "return", "new", "PkEnumeration", "(", "query", ",", "cld", ",", "primaryKeyClass", ",", "this", ")", ";", "}" ]
returns an Enumeration of PrimaryKey Objects for objects of class DataClass. The Elements returned come from a SELECT ... WHERE Statement that is defined by the fields and their coresponding values of listFields and listValues. Useful for EJB Finder Methods... @param primaryKeyClass the pk class for the searched objects @param query the query
[ "returns", "an", "Enumeration", "of", "PrimaryKey", "Objects", "for", "objects", "of", "class", "DataClass", ".", "The", "Elements", "returned", "come", "from", "a", "SELECT", "...", "WHERE", "Statement", "that", "is", "defined", "by", "the", "fields", "and", "their", "coresponding", "values", "of", "listFields", "and", "listValues", ".", "Useful", "for", "EJB", "Finder", "Methods", "..." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1830-L1837
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.store
public void store(Object obj, ObjectModification mod) throws PersistenceBrokerException { obj = extractObjectToStore(obj); // null for unmaterialized Proxy if (obj == null) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); // this call ensures that all autoincremented primary key attributes are filled Identity oid = serviceIdentity().buildIdentity(cld, obj); // select flag for insert / update selection by checking the ObjectModification if (mod.needsInsert()) { store(obj, oid, cld, true); } else if (mod.needsUpdate()) { store(obj, oid, cld, false); } /* arminw TODO: Why we need this behaviour? What about 1:1 relations? */ else { // just store 1:n and m:n associations storeCollections(obj, cld, mod.needsInsert()); } }
java
public void store(Object obj, ObjectModification mod) throws PersistenceBrokerException { obj = extractObjectToStore(obj); // null for unmaterialized Proxy if (obj == null) { return; } ClassDescriptor cld = getClassDescriptor(obj.getClass()); // this call ensures that all autoincremented primary key attributes are filled Identity oid = serviceIdentity().buildIdentity(cld, obj); // select flag for insert / update selection by checking the ObjectModification if (mod.needsInsert()) { store(obj, oid, cld, true); } else if (mod.needsUpdate()) { store(obj, oid, cld, false); } /* arminw TODO: Why we need this behaviour? What about 1:1 relations? */ else { // just store 1:n and m:n associations storeCollections(obj, cld, mod.needsInsert()); } }
[ "public", "void", "store", "(", "Object", "obj", ",", "ObjectModification", "mod", ")", "throws", "PersistenceBrokerException", "{", "obj", "=", "extractObjectToStore", "(", "obj", ")", ";", "// null for unmaterialized Proxy", "if", "(", "obj", "==", "null", ")", "{", "return", ";", "}", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "obj", ".", "getClass", "(", ")", ")", ";", "// this call ensures that all autoincremented primary key attributes are filled", "Identity", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "cld", ",", "obj", ")", ";", "// select flag for insert / update selection by checking the ObjectModification", "if", "(", "mod", ".", "needsInsert", "(", ")", ")", "{", "store", "(", "obj", ",", "oid", ",", "cld", ",", "true", ")", ";", "}", "else", "if", "(", "mod", ".", "needsUpdate", "(", ")", ")", "{", "store", "(", "obj", ",", "oid", ",", "cld", ",", "false", ")", ";", "}", "/*\n arminw\n TODO: Why we need this behaviour? What about 1:1 relations?\n */", "else", "{", "// just store 1:n and m:n associations", "storeCollections", "(", "obj", ",", "cld", ",", "mod", ".", "needsInsert", "(", ")", ")", ";", "}", "}" ]
Makes object obj persistent in the underlying persistence system. E.G. by INSERT INTO ... or UPDATE ... in an RDBMS. The ObjectModification parameter can be used to determine whether INSERT or update is to be used. This functionality is typically called from transaction managers, that track which objects have to be stored. If the object is an unmaterialized proxy the method return immediately.
[ "Makes", "object", "obj", "persistent", "in", "the", "underlying", "persistence", "system", ".", "E", ".", "G", ".", "by", "INSERT", "INTO", "...", "or", "UPDATE", "...", "in", "an", "RDBMS", ".", "The", "ObjectModification", "parameter", "can", "be", "used", "to", "determine", "whether", "INSERT", "or", "update", "is", "to", "be", "used", ".", "This", "functionality", "is", "typically", "called", "from", "transaction", "managers", "that", "track", "which", "objects", "have", "to", "be", "stored", ".", "If", "the", "object", "is", "an", "unmaterialized", "proxy", "the", "method", "return", "immediately", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1847-L1877
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.storeToDb
private void storeToDb(Object obj, ClassDescriptor cld, Identity oid, boolean insert, boolean ignoreReferences) { // 1. link and store 1:1 references storeReferences(obj, cld, insert, ignoreReferences); Object[] pkValues = oid.getPrimaryKeyValues(); if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues)) { // BRJ: fk values may be part of pk, but the are not known during // creation of Identity. so we have to get them here pkValues = serviceBrokerHelper().getKeyValues(cld, obj); if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues)) { String append = insert ? " on insert" : " on update" ; throw new PersistenceBrokerException("assertValidPkFields failed for Object of type: " + cld.getClassNameOfObject() + append); } } // get super class cld then store it with the object /* now for multiple table inheritance 1. store super classes, topmost parent first 2. go down through heirarchy until current class 3. todo: store to full extent? // arminw: TODO: The extend-attribute feature dosn't work, should we remove this stuff? This if-clause will go up the inheritance heirarchy to store all the super classes. The id for the top most super class will be the id for all the subclasses too */ if(cld.getSuperClass() != null) { ClassDescriptor superCld = getDescriptorRepository().getDescriptorFor(cld.getSuperClass()); storeToDb(obj, superCld, oid, insert); // arminw: why this?? I comment out this section // storeCollections(obj, cld.getCollectionDescriptors(), insert); } // 2. store primitive typed attributes (Or is THIS step 3 ?) // if obj not present in db use INSERT if (insert) { dbAccess.executeInsert(cld, obj); if(oid.isTransient()) { // Create a new Identity based on the current set of primary key values. oid = serviceIdentity().buildIdentity(cld, obj); } } // else use UPDATE else { try { dbAccess.executeUpdate(cld, obj); } catch(OptimisticLockException e) { // ensure that the outdated object be removed from cache objectCache.remove(oid); throw e; } } // cache object for symmetry with getObjectByXXX() // Add the object to the cache. objectCache.doInternalCache(oid, obj, ObjectCacheInternal.TYPE_WRITE); // 3. store 1:n and m:n associations if(!ignoreReferences) storeCollections(obj, cld, insert); }
java
private void storeToDb(Object obj, ClassDescriptor cld, Identity oid, boolean insert, boolean ignoreReferences) { // 1. link and store 1:1 references storeReferences(obj, cld, insert, ignoreReferences); Object[] pkValues = oid.getPrimaryKeyValues(); if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues)) { // BRJ: fk values may be part of pk, but the are not known during // creation of Identity. so we have to get them here pkValues = serviceBrokerHelper().getKeyValues(cld, obj); if (!serviceBrokerHelper().assertValidPksForStore(cld.getPkFields(), pkValues)) { String append = insert ? " on insert" : " on update" ; throw new PersistenceBrokerException("assertValidPkFields failed for Object of type: " + cld.getClassNameOfObject() + append); } } // get super class cld then store it with the object /* now for multiple table inheritance 1. store super classes, topmost parent first 2. go down through heirarchy until current class 3. todo: store to full extent? // arminw: TODO: The extend-attribute feature dosn't work, should we remove this stuff? This if-clause will go up the inheritance heirarchy to store all the super classes. The id for the top most super class will be the id for all the subclasses too */ if(cld.getSuperClass() != null) { ClassDescriptor superCld = getDescriptorRepository().getDescriptorFor(cld.getSuperClass()); storeToDb(obj, superCld, oid, insert); // arminw: why this?? I comment out this section // storeCollections(obj, cld.getCollectionDescriptors(), insert); } // 2. store primitive typed attributes (Or is THIS step 3 ?) // if obj not present in db use INSERT if (insert) { dbAccess.executeInsert(cld, obj); if(oid.isTransient()) { // Create a new Identity based on the current set of primary key values. oid = serviceIdentity().buildIdentity(cld, obj); } } // else use UPDATE else { try { dbAccess.executeUpdate(cld, obj); } catch(OptimisticLockException e) { // ensure that the outdated object be removed from cache objectCache.remove(oid); throw e; } } // cache object for symmetry with getObjectByXXX() // Add the object to the cache. objectCache.doInternalCache(oid, obj, ObjectCacheInternal.TYPE_WRITE); // 3. store 1:n and m:n associations if(!ignoreReferences) storeCollections(obj, cld, insert); }
[ "private", "void", "storeToDb", "(", "Object", "obj", ",", "ClassDescriptor", "cld", ",", "Identity", "oid", ",", "boolean", "insert", ",", "boolean", "ignoreReferences", ")", "{", "// 1. link and store 1:1 references", "storeReferences", "(", "obj", ",", "cld", ",", "insert", ",", "ignoreReferences", ")", ";", "Object", "[", "]", "pkValues", "=", "oid", ".", "getPrimaryKeyValues", "(", ")", ";", "if", "(", "!", "serviceBrokerHelper", "(", ")", ".", "assertValidPksForStore", "(", "cld", ".", "getPkFields", "(", ")", ",", "pkValues", ")", ")", "{", "// BRJ: fk values may be part of pk, but the are not known during", "// creation of Identity. so we have to get them here", "pkValues", "=", "serviceBrokerHelper", "(", ")", ".", "getKeyValues", "(", "cld", ",", "obj", ")", ";", "if", "(", "!", "serviceBrokerHelper", "(", ")", ".", "assertValidPksForStore", "(", "cld", ".", "getPkFields", "(", ")", ",", "pkValues", ")", ")", "{", "String", "append", "=", "insert", "?", "\" on insert\"", ":", "\" on update\"", ";", "throw", "new", "PersistenceBrokerException", "(", "\"assertValidPkFields failed for Object of type: \"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "append", ")", ";", "}", "}", "// get super class cld then store it with the object", "/*\n now for multiple table inheritance\n 1. store super classes, topmost parent first\n 2. go down through heirarchy until current class\n 3. todo: store to full extent?\n\n// arminw: TODO: The extend-attribute feature dosn't work, should we remove this stuff?\n This if-clause will go up the inheritance heirarchy to store all the super classes.\n The id for the top most super class will be the id for all the subclasses too\n */", "if", "(", "cld", ".", "getSuperClass", "(", ")", "!=", "null", ")", "{", "ClassDescriptor", "superCld", "=", "getDescriptorRepository", "(", ")", ".", "getDescriptorFor", "(", "cld", ".", "getSuperClass", "(", ")", ")", ";", "storeToDb", "(", "obj", ",", "superCld", ",", "oid", ",", "insert", ")", ";", "// arminw: why this?? I comment out this section", "// storeCollections(obj, cld.getCollectionDescriptors(), insert);", "}", "// 2. store primitive typed attributes (Or is THIS step 3 ?)", "// if obj not present in db use INSERT", "if", "(", "insert", ")", "{", "dbAccess", ".", "executeInsert", "(", "cld", ",", "obj", ")", ";", "if", "(", "oid", ".", "isTransient", "(", ")", ")", "{", "// Create a new Identity based on the current set of primary key values.", "oid", "=", "serviceIdentity", "(", ")", ".", "buildIdentity", "(", "cld", ",", "obj", ")", ";", "}", "}", "// else use UPDATE", "else", "{", "try", "{", "dbAccess", ".", "executeUpdate", "(", "cld", ",", "obj", ")", ";", "}", "catch", "(", "OptimisticLockException", "e", ")", "{", "// ensure that the outdated object be removed from cache", "objectCache", ".", "remove", "(", "oid", ")", ";", "throw", "e", ";", "}", "}", "// cache object for symmetry with getObjectByXXX()", "// Add the object to the cache.", "objectCache", ".", "doInternalCache", "(", "oid", ",", "obj", ",", "ObjectCacheInternal", ".", "TYPE_WRITE", ")", ";", "// 3. store 1:n and m:n associations", "if", "(", "!", "ignoreReferences", ")", "storeCollections", "(", "obj", ",", "cld", ",", "insert", ")", ";", "}" ]
I pulled this out of internal store so that when doing multiple table inheritance, i can recurse this function. @param obj @param cld @param oid BRJ: what is it good for ??? @param insert @param ignoreReferences
[ "I", "pulled", "this", "out", "of", "internal", "store", "so", "that", "when", "doing", "multiple", "table", "inheritance", "i", "can", "recurse", "this", "function", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1889-L1957
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getReportQueryIteratorByQuery
public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException { ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return getReportQueryIteratorFromQuery(query, cld); }
java
public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException { ClassDescriptor cld = getClassDescriptor(query.getSearchClass()); return getReportQueryIteratorFromQuery(query, cld); }
[ "public", "Iterator", "getReportQueryIteratorByQuery", "(", "Query", "query", ")", "throws", "PersistenceBrokerException", "{", "ClassDescriptor", "cld", "=", "getClassDescriptor", "(", "query", ".", "getSearchClass", "(", ")", ")", ";", "return", "getReportQueryIteratorFromQuery", "(", "query", ",", "cld", ")", ";", "}" ]
Get an Iterator based on the ReportQuery @param query @return Iterator
[ "Get", "an", "Iterator", "based", "on", "the", "ReportQuery" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L2084-L2088
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getRsIteratorFromQuery
private OJBIterator getRsIteratorFromQuery(Query query, ClassDescriptor cld, RsIteratorFactory factory) throws PersistenceBrokerException { query.setFetchSize(1); if (query instanceof QueryBySQL) { if(logger.isDebugEnabled()) logger.debug("Creating SQL-RsIterator for class ["+cld.getClassNameOfObject()+"]"); return factory.createRsIterator((QueryBySQL) query, cld, this); } if (!cld.isExtent() || !query.getWithExtents()) { // no extents just use the plain vanilla RsIterator if(logger.isDebugEnabled()) logger.debug("Creating RsIterator for class ["+cld.getClassNameOfObject()+"]"); return factory.createRsIterator(query, cld, this); } if(logger.isDebugEnabled()) logger.debug("Creating ChainingIterator for class ["+cld.getClassNameOfObject()+"]"); ChainingIterator chainingIter = new ChainingIterator(); // BRJ: add base class iterator if (!cld.isInterface()) { if(logger.isDebugEnabled()) logger.debug("Adding RsIterator for class ["+cld.getClassNameOfObject()+"] to ChainingIterator"); chainingIter.addIterator(factory.createRsIterator(query, cld, this)); } Iterator extents = getDescriptorRepository().getAllConcreteSubclassDescriptors(cld).iterator(); while (extents.hasNext()) { ClassDescriptor extCld = (ClassDescriptor) extents.next(); // read same table only once if (chainingIter.containsIteratorForTable(extCld.getFullTableName())) { if(logger.isDebugEnabled()) logger.debug("Skipping class ["+extCld.getClassNameOfObject()+"]"); } else { if(logger.isDebugEnabled()) logger.debug("Adding RsIterator of class ["+extCld.getClassNameOfObject()+"] to ChainingIterator"); // add the iterator to the chaining iterator. chainingIter.addIterator(factory.createRsIterator(query, extCld, this)); } } return chainingIter; }
java
private OJBIterator getRsIteratorFromQuery(Query query, ClassDescriptor cld, RsIteratorFactory factory) throws PersistenceBrokerException { query.setFetchSize(1); if (query instanceof QueryBySQL) { if(logger.isDebugEnabled()) logger.debug("Creating SQL-RsIterator for class ["+cld.getClassNameOfObject()+"]"); return factory.createRsIterator((QueryBySQL) query, cld, this); } if (!cld.isExtent() || !query.getWithExtents()) { // no extents just use the plain vanilla RsIterator if(logger.isDebugEnabled()) logger.debug("Creating RsIterator for class ["+cld.getClassNameOfObject()+"]"); return factory.createRsIterator(query, cld, this); } if(logger.isDebugEnabled()) logger.debug("Creating ChainingIterator for class ["+cld.getClassNameOfObject()+"]"); ChainingIterator chainingIter = new ChainingIterator(); // BRJ: add base class iterator if (!cld.isInterface()) { if(logger.isDebugEnabled()) logger.debug("Adding RsIterator for class ["+cld.getClassNameOfObject()+"] to ChainingIterator"); chainingIter.addIterator(factory.createRsIterator(query, cld, this)); } Iterator extents = getDescriptorRepository().getAllConcreteSubclassDescriptors(cld).iterator(); while (extents.hasNext()) { ClassDescriptor extCld = (ClassDescriptor) extents.next(); // read same table only once if (chainingIter.containsIteratorForTable(extCld.getFullTableName())) { if(logger.isDebugEnabled()) logger.debug("Skipping class ["+extCld.getClassNameOfObject()+"]"); } else { if(logger.isDebugEnabled()) logger.debug("Adding RsIterator of class ["+extCld.getClassNameOfObject()+"] to ChainingIterator"); // add the iterator to the chaining iterator. chainingIter.addIterator(factory.createRsIterator(query, extCld, this)); } } return chainingIter; }
[ "private", "OJBIterator", "getRsIteratorFromQuery", "(", "Query", "query", ",", "ClassDescriptor", "cld", ",", "RsIteratorFactory", "factory", ")", "throws", "PersistenceBrokerException", "{", "query", ".", "setFetchSize", "(", "1", ")", ";", "if", "(", "query", "instanceof", "QueryBySQL", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Creating SQL-RsIterator for class [\"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\"]\"", ")", ";", "return", "factory", ".", "createRsIterator", "(", "(", "QueryBySQL", ")", "query", ",", "cld", ",", "this", ")", ";", "}", "if", "(", "!", "cld", ".", "isExtent", "(", ")", "||", "!", "query", ".", "getWithExtents", "(", ")", ")", "{", "// no extents just use the plain vanilla RsIterator", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Creating RsIterator for class [\"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\"]\"", ")", ";", "return", "factory", ".", "createRsIterator", "(", "query", ",", "cld", ",", "this", ")", ";", "}", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Creating ChainingIterator for class [\"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\"]\"", ")", ";", "ChainingIterator", "chainingIter", "=", "new", "ChainingIterator", "(", ")", ";", "// BRJ: add base class iterator", "if", "(", "!", "cld", ".", "isInterface", "(", ")", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Adding RsIterator for class [\"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\"] to ChainingIterator\"", ")", ";", "chainingIter", ".", "addIterator", "(", "factory", ".", "createRsIterator", "(", "query", ",", "cld", ",", "this", ")", ")", ";", "}", "Iterator", "extents", "=", "getDescriptorRepository", "(", ")", ".", "getAllConcreteSubclassDescriptors", "(", "cld", ")", ".", "iterator", "(", ")", ";", "while", "(", "extents", ".", "hasNext", "(", ")", ")", "{", "ClassDescriptor", "extCld", "=", "(", "ClassDescriptor", ")", "extents", ".", "next", "(", ")", ";", "// read same table only once", "if", "(", "chainingIter", ".", "containsIteratorForTable", "(", "extCld", ".", "getFullTableName", "(", ")", ")", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Skipping class [\"", "+", "extCld", ".", "getClassNameOfObject", "(", ")", "+", "\"]\"", ")", ";", "}", "else", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"Adding RsIterator of class [\"", "+", "extCld", ".", "getClassNameOfObject", "(", ")", "+", "\"] to ChainingIterator\"", ")", ";", "// add the iterator to the chaining iterator.", "chainingIter", ".", "addIterator", "(", "factory", ".", "createRsIterator", "(", "query", ",", "extCld", ",", "this", ")", ")", ";", "}", "}", "return", "chainingIter", ";", "}" ]
Get an extent aware RsIterator based on the Query @param query @param cld @param factory the Factory for the RsIterator @return OJBIterator
[ "Get", "an", "extent", "aware", "RsIterator", "based", "on", "the", "Query" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L2098-L2148
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.getReportQueryIteratorFromQuery
private OJBIterator getReportQueryIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { RsIteratorFactory factory = ReportRsIteratorFactoryImpl.getInstance(); OJBIterator result = getRsIteratorFromQuery(query, cld, factory); if (query.usePaging()) { result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex()); } return result; }
java
private OJBIterator getReportQueryIteratorFromQuery(Query query, ClassDescriptor cld) throws PersistenceBrokerException { RsIteratorFactory factory = ReportRsIteratorFactoryImpl.getInstance(); OJBIterator result = getRsIteratorFromQuery(query, cld, factory); if (query.usePaging()) { result = new PagingIterator(result, query.getStartAtIndex(), query.getEndAtIndex()); } return result; }
[ "private", "OJBIterator", "getReportQueryIteratorFromQuery", "(", "Query", "query", ",", "ClassDescriptor", "cld", ")", "throws", "PersistenceBrokerException", "{", "RsIteratorFactory", "factory", "=", "ReportRsIteratorFactoryImpl", ".", "getInstance", "(", ")", ";", "OJBIterator", "result", "=", "getRsIteratorFromQuery", "(", "query", ",", "cld", ",", "factory", ")", ";", "if", "(", "query", ".", "usePaging", "(", ")", ")", "{", "result", "=", "new", "PagingIterator", "(", "result", ",", "query", ".", "getStartAtIndex", "(", ")", ",", "query", ".", "getEndAtIndex", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Get an extent aware Iterator based on the ReportQuery @param query @param cld @return OJBIterator
[ "Get", "an", "extent", "aware", "Iterator", "based", "on", "the", "ReportQuery" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L2157-L2168
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/db/DataUtils.java
DataUtils.getModuleName
public static String getModuleName(final String moduleId) { final int splitter = moduleId.indexOf(':'); if(splitter == -1){ return moduleId; } return moduleId.substring(0, splitter); }
java
public static String getModuleName(final String moduleId) { final int splitter = moduleId.indexOf(':'); if(splitter == -1){ return moduleId; } return moduleId.substring(0, splitter); }
[ "public", "static", "String", "getModuleName", "(", "final", "String", "moduleId", ")", "{", "final", "int", "splitter", "=", "moduleId", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "splitter", "==", "-", "1", ")", "{", "return", "moduleId", ";", "}", "return", "moduleId", ".", "substring", "(", "0", ",", "splitter", ")", ";", "}" ]
Split a module Id to get the module name @param moduleId @return String
[ "Split", "a", "module", "Id", "to", "get", "the", "module", "name" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/DataUtils.java#L100-L106
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/db/DataUtils.java
DataUtils.getModuleVersion
public static String getModuleVersion(final String moduleId) { final int splitter = moduleId.lastIndexOf(':'); if(splitter == -1){ return moduleId; } return moduleId.substring(splitter+1); }
java
public static String getModuleVersion(final String moduleId) { final int splitter = moduleId.lastIndexOf(':'); if(splitter == -1){ return moduleId; } return moduleId.substring(splitter+1); }
[ "public", "static", "String", "getModuleVersion", "(", "final", "String", "moduleId", ")", "{", "final", "int", "splitter", "=", "moduleId", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "splitter", "==", "-", "1", ")", "{", "return", "moduleId", ";", "}", "return", "moduleId", ".", "substring", "(", "splitter", "+", "1", ")", ";", "}" ]
Split a module Id to get the module version @param moduleId @return String
[ "Split", "a", "module", "Id", "to", "get", "the", "module", "version" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/DataUtils.java#L113-L119
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/db/DataUtils.java
DataUtils.getGroupId
public static String getGroupId(final String gavc) { final int splitter = gavc.indexOf(':'); if(splitter == -1){ return gavc; } return gavc.substring(0, splitter); }
java
public static String getGroupId(final String gavc) { final int splitter = gavc.indexOf(':'); if(splitter == -1){ return gavc; } return gavc.substring(0, splitter); }
[ "public", "static", "String", "getGroupId", "(", "final", "String", "gavc", ")", "{", "final", "int", "splitter", "=", "gavc", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "splitter", "==", "-", "1", ")", "{", "return", "gavc", ";", "}", "return", "gavc", ".", "substring", "(", "0", ",", "splitter", ")", ";", "}" ]
Split an artifact gavc to get the groupId @param gavc @return String
[ "Split", "an", "artifact", "gavc", "to", "get", "the", "groupId" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/DataUtils.java#L126-L132
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/db/DataUtils.java
DataUtils.getAllSubmodules
public static List<DbModule> getAllSubmodules(final DbModule module) { final List<DbModule> submodules = new ArrayList<DbModule>(); submodules.addAll(module.getSubmodules()); for(final DbModule submodule: module.getSubmodules()){ submodules.addAll(getAllSubmodules(submodule)); } return submodules; }
java
public static List<DbModule> getAllSubmodules(final DbModule module) { final List<DbModule> submodules = new ArrayList<DbModule>(); submodules.addAll(module.getSubmodules()); for(final DbModule submodule: module.getSubmodules()){ submodules.addAll(getAllSubmodules(submodule)); } return submodules; }
[ "public", "static", "List", "<", "DbModule", ">", "getAllSubmodules", "(", "final", "DbModule", "module", ")", "{", "final", "List", "<", "DbModule", ">", "submodules", "=", "new", "ArrayList", "<", "DbModule", ">", "(", ")", ";", "submodules", ".", "addAll", "(", "module", ".", "getSubmodules", "(", ")", ")", ";", "for", "(", "final", "DbModule", "submodule", ":", "module", ".", "getSubmodules", "(", ")", ")", "{", "submodules", ".", "addAll", "(", "getAllSubmodules", "(", "submodule", ")", ")", ";", "}", "return", "submodules", ";", "}" ]
Return the list of all the module submodules @param module @return List<DbModule>
[ "Return", "the", "list", "of", "all", "the", "module", "submodules" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/db/DataUtils.java#L218-L227
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/options/ScopeHandler.java
ScopeHandler.init
public void init(final MultivaluedMap<String, String> queryParameters) { final String scopeCompileParam = queryParameters.getFirst(ServerAPI.SCOPE_COMPILE_PARAM); if(scopeCompileParam != null){ this.scopeComp = Boolean.valueOf(scopeCompileParam); } final String scopeProvidedParam = queryParameters.getFirst(ServerAPI.SCOPE_PROVIDED_PARAM); if(scopeProvidedParam != null){ this.scopePro = Boolean.valueOf(scopeProvidedParam); } final String scopeRuntimeParam = queryParameters.getFirst(ServerAPI.SCOPE_RUNTIME_PARAM); if(scopeRuntimeParam != null){ this.scopeRun = Boolean.valueOf(scopeRuntimeParam); } final String scopeTestParam = queryParameters.getFirst(ServerAPI.SCOPE_TEST_PARAM); if(scopeTestParam != null){ this.scopeTest = Boolean.valueOf(scopeTestParam); } }
java
public void init(final MultivaluedMap<String, String> queryParameters) { final String scopeCompileParam = queryParameters.getFirst(ServerAPI.SCOPE_COMPILE_PARAM); if(scopeCompileParam != null){ this.scopeComp = Boolean.valueOf(scopeCompileParam); } final String scopeProvidedParam = queryParameters.getFirst(ServerAPI.SCOPE_PROVIDED_PARAM); if(scopeProvidedParam != null){ this.scopePro = Boolean.valueOf(scopeProvidedParam); } final String scopeRuntimeParam = queryParameters.getFirst(ServerAPI.SCOPE_RUNTIME_PARAM); if(scopeRuntimeParam != null){ this.scopeRun = Boolean.valueOf(scopeRuntimeParam); } final String scopeTestParam = queryParameters.getFirst(ServerAPI.SCOPE_TEST_PARAM); if(scopeTestParam != null){ this.scopeTest = Boolean.valueOf(scopeTestParam); } }
[ "public", "void", "init", "(", "final", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParameters", ")", "{", "final", "String", "scopeCompileParam", "=", "queryParameters", ".", "getFirst", "(", "ServerAPI", ".", "SCOPE_COMPILE_PARAM", ")", ";", "if", "(", "scopeCompileParam", "!=", "null", ")", "{", "this", ".", "scopeComp", "=", "Boolean", ".", "valueOf", "(", "scopeCompileParam", ")", ";", "}", "final", "String", "scopeProvidedParam", "=", "queryParameters", ".", "getFirst", "(", "ServerAPI", ".", "SCOPE_PROVIDED_PARAM", ")", ";", "if", "(", "scopeProvidedParam", "!=", "null", ")", "{", "this", ".", "scopePro", "=", "Boolean", ".", "valueOf", "(", "scopeProvidedParam", ")", ";", "}", "final", "String", "scopeRuntimeParam", "=", "queryParameters", ".", "getFirst", "(", "ServerAPI", ".", "SCOPE_RUNTIME_PARAM", ")", ";", "if", "(", "scopeRuntimeParam", "!=", "null", ")", "{", "this", ".", "scopeRun", "=", "Boolean", ".", "valueOf", "(", "scopeRuntimeParam", ")", ";", "}", "final", "String", "scopeTestParam", "=", "queryParameters", ".", "getFirst", "(", "ServerAPI", ".", "SCOPE_TEST_PARAM", ")", ";", "if", "(", "scopeTestParam", "!=", "null", ")", "{", "this", ".", "scopeTest", "=", "Boolean", ".", "valueOf", "(", "scopeTestParam", ")", ";", "}", "}" ]
The parameter must never be null @param queryParameters
[ "The", "parameter", "must", "never", "be", "null" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/options/ScopeHandler.java#L36-L53
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/PBCapsule.java
PBCapsule.obtainBroker
private PersistenceBroker obtainBroker() { PersistenceBroker _broker; try { if (pbKey == null) { //throw new OJBRuntimeException("Not possible to do action, cause no tx runnning and no PBKey is set"); log.warn("No tx runnning and PBKey is null, try to use the default PB"); _broker = PersistenceBrokerFactory.defaultPersistenceBroker(); } else { _broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey); } } catch (PBFactoryException e) { log.error("Could not obtain PB for PBKey " + pbKey, e); throw new OJBRuntimeException("Unexpected micro-kernel exception", e); } return _broker; }
java
private PersistenceBroker obtainBroker() { PersistenceBroker _broker; try { if (pbKey == null) { //throw new OJBRuntimeException("Not possible to do action, cause no tx runnning and no PBKey is set"); log.warn("No tx runnning and PBKey is null, try to use the default PB"); _broker = PersistenceBrokerFactory.defaultPersistenceBroker(); } else { _broker = PersistenceBrokerFactory.createPersistenceBroker(pbKey); } } catch (PBFactoryException e) { log.error("Could not obtain PB for PBKey " + pbKey, e); throw new OJBRuntimeException("Unexpected micro-kernel exception", e); } return _broker; }
[ "private", "PersistenceBroker", "obtainBroker", "(", ")", "{", "PersistenceBroker", "_broker", ";", "try", "{", "if", "(", "pbKey", "==", "null", ")", "{", "//throw new OJBRuntimeException(\"Not possible to do action, cause no tx runnning and no PBKey is set\");\r", "log", ".", "warn", "(", "\"No tx runnning and PBKey is null, try to use the default PB\"", ")", ";", "_broker", "=", "PersistenceBrokerFactory", ".", "defaultPersistenceBroker", "(", ")", ";", "}", "else", "{", "_broker", "=", "PersistenceBrokerFactory", ".", "createPersistenceBroker", "(", "pbKey", ")", ";", "}", "}", "catch", "(", "PBFactoryException", "e", ")", "{", "log", ".", "error", "(", "\"Could not obtain PB for PBKey \"", "+", "pbKey", ",", "e", ")", ";", "throw", "new", "OJBRuntimeException", "(", "\"Unexpected micro-kernel exception\"", ",", "e", ")", ";", "}", "return", "_broker", ";", "}" ]
Used to get PB, when no tx is running.
[ "Used", "to", "get", "PB", "when", "no", "tx", "is", "running", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/PBCapsule.java#L111-L133
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
SequenceManagerHighLowImpl.addSequence
private void addSequence(String sequenceName, HighLowSequence seq) { // lookup the sequence map for calling DB String jcdAlias = getBrokerForClass() .serviceConnectionManager().getConnectionDescriptor().getJcdAlias(); Map mapForDB = (Map) sequencesDBMap.get(jcdAlias); if(mapForDB == null) { mapForDB = new HashMap(); } mapForDB.put(sequenceName, seq); sequencesDBMap.put(jcdAlias, mapForDB); }
java
private void addSequence(String sequenceName, HighLowSequence seq) { // lookup the sequence map for calling DB String jcdAlias = getBrokerForClass() .serviceConnectionManager().getConnectionDescriptor().getJcdAlias(); Map mapForDB = (Map) sequencesDBMap.get(jcdAlias); if(mapForDB == null) { mapForDB = new HashMap(); } mapForDB.put(sequenceName, seq); sequencesDBMap.put(jcdAlias, mapForDB); }
[ "private", "void", "addSequence", "(", "String", "sequenceName", ",", "HighLowSequence", "seq", ")", "{", "// lookup the sequence map for calling DB\r", "String", "jcdAlias", "=", "getBrokerForClass", "(", ")", ".", "serviceConnectionManager", "(", ")", ".", "getConnectionDescriptor", "(", ")", ".", "getJcdAlias", "(", ")", ";", "Map", "mapForDB", "=", "(", "Map", ")", "sequencesDBMap", ".", "get", "(", "jcdAlias", ")", ";", "if", "(", "mapForDB", "==", "null", ")", "{", "mapForDB", "=", "new", "HashMap", "(", ")", ";", "}", "mapForDB", ".", "put", "(", "sequenceName", ",", "seq", ")", ";", "sequencesDBMap", ".", "put", "(", "jcdAlias", ",", "mapForDB", ")", ";", "}" ]
Put new sequence object for given sequence name. @param sequenceName Name of the sequence. @param seq The sequence object to add.
[ "Put", "new", "sequence", "object", "for", "given", "sequence", "name", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java#L214-L226
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java
SequenceManagerHighLowImpl.removeSequence
protected void removeSequence(String sequenceName) { // lookup the sequence map for calling DB Map mapForDB = (Map) sequencesDBMap.get(getBrokerForClass() .serviceConnectionManager().getConnectionDescriptor().getJcdAlias()); if(mapForDB != null) { synchronized(SequenceManagerHighLowImpl.class) { mapForDB.remove(sequenceName); } } }
java
protected void removeSequence(String sequenceName) { // lookup the sequence map for calling DB Map mapForDB = (Map) sequencesDBMap.get(getBrokerForClass() .serviceConnectionManager().getConnectionDescriptor().getJcdAlias()); if(mapForDB != null) { synchronized(SequenceManagerHighLowImpl.class) { mapForDB.remove(sequenceName); } } }
[ "protected", "void", "removeSequence", "(", "String", "sequenceName", ")", "{", "// lookup the sequence map for calling DB\r", "Map", "mapForDB", "=", "(", "Map", ")", "sequencesDBMap", ".", "get", "(", "getBrokerForClass", "(", ")", ".", "serviceConnectionManager", "(", ")", ".", "getConnectionDescriptor", "(", ")", ".", "getJcdAlias", "(", ")", ")", ";", "if", "(", "mapForDB", "!=", "null", ")", "{", "synchronized", "(", "SequenceManagerHighLowImpl", ".", "class", ")", "{", "mapForDB", ".", "remove", "(", "sequenceName", ")", ";", "}", "}", "}" ]
Remove the sequence for given sequence name. @param sequenceName Name of the sequence to remove.
[ "Remove", "the", "sequence", "for", "given", "sequence", "name", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHighLowImpl.java#L233-L245
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java
JdbcConnectionDescriptor.getPBKey
public PBKey getPBKey() { if (pbKey == null) { this.pbKey = new PBKey(this.getJcdAlias(), this.getUserName(), this.getPassWord()); } return pbKey; }
java
public PBKey getPBKey() { if (pbKey == null) { this.pbKey = new PBKey(this.getJcdAlias(), this.getUserName(), this.getPassWord()); } return pbKey; }
[ "public", "PBKey", "getPBKey", "(", ")", "{", "if", "(", "pbKey", "==", "null", ")", "{", "this", ".", "pbKey", "=", "new", "PBKey", "(", "this", ".", "getJcdAlias", "(", ")", ",", "this", ".", "getUserName", "(", ")", ",", "this", ".", "getPassWord", "(", ")", ")", ";", "}", "return", "pbKey", ";", "}" ]
Return a key to identify the connection descriptor.
[ "Return", "a", "key", "to", "identify", "the", "connection", "descriptor", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java#L187-L194
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java
JdbcConnectionDescriptor.setJdbcLevel
public void setJdbcLevel(String jdbcLevel) { if (jdbcLevel != null) { try { double intLevel = Double.parseDouble(jdbcLevel); setJdbcLevel(intLevel); } catch(NumberFormatException nfe) { setJdbcLevel(2.0); logger.info("Specified JDBC level was not numeric (Value=" + jdbcLevel + "), used default jdbc level of 2.0 "); } } else { setJdbcLevel(2.0); logger.info("Specified JDBC level was null, used default jdbc level of 2.0 "); } }
java
public void setJdbcLevel(String jdbcLevel) { if (jdbcLevel != null) { try { double intLevel = Double.parseDouble(jdbcLevel); setJdbcLevel(intLevel); } catch(NumberFormatException nfe) { setJdbcLevel(2.0); logger.info("Specified JDBC level was not numeric (Value=" + jdbcLevel + "), used default jdbc level of 2.0 "); } } else { setJdbcLevel(2.0); logger.info("Specified JDBC level was null, used default jdbc level of 2.0 "); } }
[ "public", "void", "setJdbcLevel", "(", "String", "jdbcLevel", ")", "{", "if", "(", "jdbcLevel", "!=", "null", ")", "{", "try", "{", "double", "intLevel", "=", "Double", ".", "parseDouble", "(", "jdbcLevel", ")", ";", "setJdbcLevel", "(", "intLevel", ")", ";", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "setJdbcLevel", "(", "2.0", ")", ";", "logger", ".", "info", "(", "\"Specified JDBC level was not numeric (Value=\"", "+", "jdbcLevel", "+", "\"), used default jdbc level of 2.0 \"", ")", ";", "}", "}", "else", "{", "setJdbcLevel", "(", "2.0", ")", ";", "logger", ".", "info", "(", "\"Specified JDBC level was null, used default jdbc level of 2.0 \"", ")", ";", "}", "}" ]
Sets the jdbcLevel. parse the string setting and check that it is indeed an integer. @param jdbcLevel The jdbcLevel to set
[ "Sets", "the", "jdbcLevel", ".", "parse", "the", "string", "setting", "and", "check", "that", "it", "is", "indeed", "an", "integer", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/metadata/JdbcConnectionDescriptor.java#L368-L388
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/LockManagerDefaultImpl.java
LockManagerDefaultImpl.checkWrite
public synchronized boolean checkWrite(TransactionImpl tx, Object obj) { if (log.isDebugEnabled()) log.debug("LM.checkWrite(tx-" + tx.getGUID() + ", " + new Identity(obj, tx.getBroker()).toString() + ")"); LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj); return lockStrategy.checkWrite(tx, obj); }
java
public synchronized boolean checkWrite(TransactionImpl tx, Object obj) { if (log.isDebugEnabled()) log.debug("LM.checkWrite(tx-" + tx.getGUID() + ", " + new Identity(obj, tx.getBroker()).toString() + ")"); LockStrategy lockStrategy = LockStrategyFactory.getStrategyFor(obj); return lockStrategy.checkWrite(tx, obj); }
[ "public", "synchronized", "boolean", "checkWrite", "(", "TransactionImpl", "tx", ",", "Object", "obj", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "(", "\"LM.checkWrite(tx-\"", "+", "tx", ".", "getGUID", "(", ")", "+", "\", \"", "+", "new", "Identity", "(", "obj", ",", "tx", ".", "getBroker", "(", ")", ")", ".", "toString", "(", ")", "+", "\")\"", ")", ";", "LockStrategy", "lockStrategy", "=", "LockStrategyFactory", ".", "getStrategyFor", "(", "obj", ")", ";", "return", "lockStrategy", ".", "checkWrite", "(", "tx", ",", "obj", ")", ";", "}" ]
checks if there is a writelock for transaction tx on object obj. Returns true if so, else false.
[ "checks", "if", "there", "is", "a", "writelock", "for", "transaction", "tx", "on", "object", "obj", ".", "Returns", "true", "if", "so", "else", "false", "." ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/LockManagerDefaultImpl.java#L142-L147
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/states/StateOldDelete.java
StateOldDelete.checkpoint
public void checkpoint(ObjectEnvelope mod) throws org.apache.ojb.broker.PersistenceBrokerException { mod.doDelete(); mod.setModificationState(StateTransient.getInstance()); }
java
public void checkpoint(ObjectEnvelope mod) throws org.apache.ojb.broker.PersistenceBrokerException { mod.doDelete(); mod.setModificationState(StateTransient.getInstance()); }
[ "public", "void", "checkpoint", "(", "ObjectEnvelope", "mod", ")", "throws", "org", ".", "apache", ".", "ojb", ".", "broker", ".", "PersistenceBrokerException", "{", "mod", ".", "doDelete", "(", ")", ";", "mod", ".", "setModificationState", "(", "StateTransient", ".", "getInstance", "(", ")", ")", ";", "}" ]
rollback the transaction
[ "rollback", "the", "transaction" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/states/StateOldDelete.java#L95-L100
train
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/states/StateNewDirty.java
StateNewDirty.checkpoint
public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException { mod.doInsert(); mod.setModificationState(StateOldClean.getInstance()); }
java
public void checkpoint(ObjectEnvelope mod) throws PersistenceBrokerException { mod.doInsert(); mod.setModificationState(StateOldClean.getInstance()); }
[ "public", "void", "checkpoint", "(", "ObjectEnvelope", "mod", ")", "throws", "PersistenceBrokerException", "{", "mod", ".", "doInsert", "(", ")", ";", "mod", ".", "setModificationState", "(", "StateOldClean", ".", "getInstance", "(", ")", ")", ";", "}" ]
checkpoint the ObjectModification
[ "checkpoint", "the", "ObjectModification" ]
9a544372f67ce965f662cdc71609dd03683c8f04
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/states/StateNewDirty.java#L95-L99
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java
ModuleHandler.getModuleVersions
public List<String> getModuleVersions(final String name, final FiltersHolder filters) { final List<String> versions = repositoryHandler.getModuleVersions(name, filters); if (versions.isEmpty()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Module " + name + " does not exist.").build()); } return versions; }
java
public List<String> getModuleVersions(final String name, final FiltersHolder filters) { final List<String> versions = repositoryHandler.getModuleVersions(name, filters); if (versions.isEmpty()) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Module " + name + " does not exist.").build()); } return versions; }
[ "public", "List", "<", "String", ">", "getModuleVersions", "(", "final", "String", "name", ",", "final", "FiltersHolder", "filters", ")", "{", "final", "List", "<", "String", ">", "versions", "=", "repositoryHandler", ".", "getModuleVersions", "(", "name", ",", "filters", ")", ";", "if", "(", "versions", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "status", "(", "Response", ".", "Status", ".", "NOT_FOUND", ")", ".", "entity", "(", "\"Module \"", "+", "name", "+", "\" does not exist.\"", ")", ".", "build", "(", ")", ")", ";", "}", "return", "versions", ";", "}" ]
Returns the available module names regarding the filters @param name String @param filters FiltersHolder @return List<String>
[ "Returns", "the", "available", "module", "names", "regarding", "the", "filters" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L76-L85
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java
ModuleHandler.getModule
public DbModule getModule(final String moduleId) { final DbModule dbModule = repositoryHandler.getModule(moduleId); if (dbModule == null) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Module " + moduleId + " does not exist.").build()); } return dbModule; }
java
public DbModule getModule(final String moduleId) { final DbModule dbModule = repositoryHandler.getModule(moduleId); if (dbModule == null) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity("Module " + moduleId + " does not exist.").build()); } return dbModule; }
[ "public", "DbModule", "getModule", "(", "final", "String", "moduleId", ")", "{", "final", "DbModule", "dbModule", "=", "repositoryHandler", ".", "getModule", "(", "moduleId", ")", ";", "if", "(", "dbModule", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "status", "(", "Response", ".", "Status", ".", "NOT_FOUND", ")", ".", "entity", "(", "\"Module \"", "+", "moduleId", "+", "\" does not exist.\"", ")", ".", "build", "(", ")", ")", ";", "}", "return", "dbModule", ";", "}" ]
Returns a module @param moduleId String @return DbModule
[ "Returns", "a", "module" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L93-L102
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java
ModuleHandler.deleteModule
public void deleteModule(final String moduleId) { final DbModule module = getModule(moduleId); repositoryHandler.deleteModule(module.getId()); for (final String gavc : DataUtils.getAllArtifacts(module)) { repositoryHandler.deleteArtifact(gavc); } }
java
public void deleteModule(final String moduleId) { final DbModule module = getModule(moduleId); repositoryHandler.deleteModule(module.getId()); for (final String gavc : DataUtils.getAllArtifacts(module)) { repositoryHandler.deleteArtifact(gavc); } }
[ "public", "void", "deleteModule", "(", "final", "String", "moduleId", ")", "{", "final", "DbModule", "module", "=", "getModule", "(", "moduleId", ")", ";", "repositoryHandler", ".", "deleteModule", "(", "module", ".", "getId", "(", ")", ")", ";", "for", "(", "final", "String", "gavc", ":", "DataUtils", ".", "getAllArtifacts", "(", "module", ")", ")", "{", "repositoryHandler", ".", "deleteArtifact", "(", "gavc", ")", ";", "}", "}" ]
Delete a module @param moduleId String
[ "Delete", "a", "module" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L109-L116
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java
ModuleHandler.getModuleLicenses
public List<DbLicense> getModuleLicenses(final String moduleId, final LicenseMatcher licenseMatcher) { final DbModule module = getModule(moduleId); final List<DbLicense> licenses = new ArrayList<>(); final FiltersHolder filters = new FiltersHolder(); final ArtifactHandler artifactHandler = new ArtifactHandler(repositoryHandler, licenseMatcher); for (final String gavc : DataUtils.getAllArtifacts(module)) { licenses.addAll(artifactHandler.getArtifactLicenses(gavc, filters)); } return licenses; }
java
public List<DbLicense> getModuleLicenses(final String moduleId, final LicenseMatcher licenseMatcher) { final DbModule module = getModule(moduleId); final List<DbLicense> licenses = new ArrayList<>(); final FiltersHolder filters = new FiltersHolder(); final ArtifactHandler artifactHandler = new ArtifactHandler(repositoryHandler, licenseMatcher); for (final String gavc : DataUtils.getAllArtifacts(module)) { licenses.addAll(artifactHandler.getArtifactLicenses(gavc, filters)); } return licenses; }
[ "public", "List", "<", "DbLicense", ">", "getModuleLicenses", "(", "final", "String", "moduleId", ",", "final", "LicenseMatcher", "licenseMatcher", ")", "{", "final", "DbModule", "module", "=", "getModule", "(", "moduleId", ")", ";", "final", "List", "<", "DbLicense", ">", "licenses", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "FiltersHolder", "filters", "=", "new", "FiltersHolder", "(", ")", ";", "final", "ArtifactHandler", "artifactHandler", "=", "new", "ArtifactHandler", "(", "repositoryHandler", ",", "licenseMatcher", ")", ";", "for", "(", "final", "String", "gavc", ":", "DataUtils", ".", "getAllArtifacts", "(", "module", ")", ")", "{", "licenses", ".", "addAll", "(", "artifactHandler", ".", "getArtifactLicenses", "(", "gavc", ",", "filters", ")", ")", ";", "}", "return", "licenses", ";", "}" ]
Return a licenses view of the targeted module @param moduleId String @return List<DbLicense>
[ "Return", "a", "licenses", "view", "of", "the", "targeted", "module" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L124-L137
train
Axway/Grapes
server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java
ModuleHandler.promoteModule
public void promoteModule(final String moduleId) { final DbModule module = getModule(moduleId); for (final String gavc : DataUtils.getAllArtifacts(module)) { final DbArtifact artifact = repositoryHandler.getArtifact(gavc); artifact.setPromoted(true); repositoryHandler.store(artifact); } repositoryHandler.promoteModule(module); }
java
public void promoteModule(final String moduleId) { final DbModule module = getModule(moduleId); for (final String gavc : DataUtils.getAllArtifacts(module)) { final DbArtifact artifact = repositoryHandler.getArtifact(gavc); artifact.setPromoted(true); repositoryHandler.store(artifact); } repositoryHandler.promoteModule(module); }
[ "public", "void", "promoteModule", "(", "final", "String", "moduleId", ")", "{", "final", "DbModule", "module", "=", "getModule", "(", "moduleId", ")", ";", "for", "(", "final", "String", "gavc", ":", "DataUtils", ".", "getAllArtifacts", "(", "module", ")", ")", "{", "final", "DbArtifact", "artifact", "=", "repositoryHandler", ".", "getArtifact", "(", "gavc", ")", ";", "artifact", ".", "setPromoted", "(", "true", ")", ";", "repositoryHandler", ".", "store", "(", "artifact", ")", ";", "}", "repositoryHandler", ".", "promoteModule", "(", "module", ")", ";", "}" ]
Perform the module promotion @param moduleId String
[ "Perform", "the", "module", "promotion" ]
ce9cc73d85f83eaa5fbc991abb593915a8c8374e
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/core/ModuleHandler.java#L144-L154
train