Skip to content

Commit 8fe093c

Browse files
committed
Java: add missing QLDoc for PersistenceXML.qll
1 parent 5b962c1 commit 8fe093c

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

java/ql/src/semmle/code/java/frameworks/javaee/PersistenceXML.qll

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides classes and predicates for working with JavaEE
3+
* persistence configuration XML files (`persistence.xml`).
4+
*/
5+
16
import java
27

38
/**
@@ -6,66 +11,94 @@ import java
611
class PersistenceXMLFile extends XMLFile {
712
PersistenceXMLFile() { this.getStem() = "persistence" }
813

14+
/** Gets the root XML element in this `persistence.xml` file. */
915
PersistenceXmlRoot getRoot() { result = this.getAChild() }
1016

11-
// convenience methods
17+
/** Gets a `shared-cache-mode` XML element nested within this `persistence.xml` file. */
1218
SharedCacheModeElement getASharedCacheModeElement() {
1319
result = this.getRoot().getAPersistenceUnitElement().getASharedCacheModeElement()
1420
}
1521

22+
/** Gets a `property` XML element nested within this `persistence.xml` file. */
1623
PersistencePropertyElement getAPropertyElement() {
1724
result =
1825
this.getRoot().getAPersistenceUnitElement().getAPropertiesElement().getAPropertyElement()
1926
}
2027
}
2128

29+
/** The root `persistence` XML element in a `persistence.xml` file. */
2230
class PersistenceXmlRoot extends XMLElement {
2331
PersistenceXmlRoot() {
2432
this.getParent() instanceof PersistenceXMLFile and
2533
this.getName() = "persistence"
2634
}
2735

36+
/** Gets a `persistence-unit` child XML element of this `persistence` XML element. */
2837
PersistenceUnitElement getAPersistenceUnitElement() { result = this.getAChild() }
2938
}
3039

40+
/**
41+
* A `persistence-unit` child XML element of the root
42+
* `persistence` XML element in a `persistence.xml` file.
43+
*/
3144
class PersistenceUnitElement extends XMLElement {
3245
PersistenceUnitElement() {
3346
this.getParent() instanceof PersistenceXmlRoot and
3447
this.getName() = "persistence-unit"
3548
}
3649

50+
/** Gets a `shared-cache-mode` child XML element of this `persistence-unit` XML element. */
3751
SharedCacheModeElement getASharedCacheModeElement() { result = this.getAChild() }
3852

53+
/** Gets a `properties` child XML element of this `persistence-unit` XML element. */
3954
PersistencePropertiesElement getAPropertiesElement() { result = this.getAChild() }
4055
}
4156

57+
/**
58+
* A `shared-cache-mode` child XML element of a `persistence-unit`
59+
* XML element in a `persistence.xml` file.
60+
*/
4261
class SharedCacheModeElement extends XMLElement {
4362
SharedCacheModeElement() {
4463
this.getParent() instanceof PersistenceUnitElement and
4564
this.getName() = "shared-cache-mode"
4665
}
4766

67+
/** Gets the value of this `shared-cache-mode` XML element. */
4868
string getValue() { result = this.getACharactersSet().getCharacters() }
4969

70+
/** Holds if this `shared-cache-mode` XML element has the value "NONE". */
5071
predicate isDisabled() { this.getValue() = "NONE" }
5172
}
5273

74+
/**
75+
* A `properties` child XML element of a `persistence-unit`
76+
* XML element in a `persistence.xml` file.
77+
*/
5378
class PersistencePropertiesElement extends XMLElement {
5479
PersistencePropertiesElement() {
5580
this.getParent() instanceof PersistenceUnitElement and
5681
this.getName() = "properties"
5782
}
5883

84+
/** Gets a `property` child XML element of this `properties` XML element. */
5985
PersistencePropertyElement getAPropertyElement() { result = this.getAChild() }
6086
}
6187

88+
/**
89+
* A `property` child XML element of a `properties`
90+
* XML element in a `persistence.xml` file.
91+
*/
6292
class PersistencePropertyElement extends XMLElement {
6393
PersistencePropertyElement() {
6494
this.getParent() instanceof PersistencePropertiesElement and
6595
this.getName() = "property"
6696
}
6797

68-
/** see http://wiki.eclipse.org/EclipseLink/Examples/JPA/Caching */
98+
/**
99+
* Holds if this `property` XML element of a `persistence.xml` file
100+
* disables the EclipseLink shared cache.
101+
*/
69102
predicate disablesEclipseLinkSharedCache() {
70103
getAttribute("name").getValue() = "eclipselink.cache.shared.default" and
71104
getAttribute("value").getValue() = "false"

0 commit comments

Comments
 (0)