You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2009/07/29 22:36:21 UTC
svn commit: r799064 - /openjpa/trunk/openjpa-project/src/doc/manual/
Author: dwoods
Date: Wed Jul 29 20:36:20 2009
New Revision: 799064
URL: http://svn.apache.org/viewvc?rev=799064&view=rev
Log:
OPENJPA-890 Fix some inconsistent whitespaces in example code around method signatures and arguments
Modified:
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml
openjpa/trunk/openjpa-project/src/doc/manual/jpa_tutorials.xml
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml
openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_arch.xml Wed Jul 29 20:36:20 2009
@@ -213,7 +213,7 @@
" FROM Employee e " +
" WHERE e.division.name = 'Research' " +
" AND e.avgHours > 40");
- List results = query.getResultList ();
+ List results = query.getResultList();
// give all those hard-working employees a raise
for (Object res : results) {
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_em.xml Wed Jul 29 20:36:20 2009
@@ -112,7 +112,7 @@
</secondary>
</indexterm>
<programlisting>
-public EntityTransaction getTransaction ();
+public EntityTransaction getTransaction();
</programlisting>
<para>
Every <classname>EntityManager</classname> has a one-to-one relation with an
@@ -495,7 +495,7 @@
</listitem>
</itemizedlist>
<programlisting>
-public void lock (Object entity, LockModeType mode);
+public void lock(Object entity, LockModeType mode);
</programlisting>
<para>
<indexterm>
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_emfactory.xml Wed Jul 29 20:36:20 2009
@@ -399,8 +399,8 @@
</secondary>
</indexterm>
<programlisting>
-public boolean isOpen ();
-public void close ();
+public boolean isOpen();
+public void close();
</programlisting>
<para>
<classname>EntityManagerFactory</classname> instances are heavyweight objects.
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_mapping.xml Wed Jul 29 20:36:20 2009
@@ -3124,8 +3124,8 @@
@Basic(fetch=FetchType.LAZY)
@Column(name="ELITE")
- private boolean getEliteClub () { ... }
- public void setEliteClub (boolean elite) { ... }
+ private boolean getEliteClub() { ... }
+ public void setEliteClub(boolean elite) { ... }
...
}
@@ -3136,8 +3136,8 @@
extends Subscription {
@Column(name="END")
- public Date getEndDate () { ... }
- public void setEndDate (Date end) { ... }
+ public Date getEndDate() { ... }
+ public void setEndDate(Date end) { ... }
...
}
@@ -4581,8 +4581,8 @@
@Basic(fetch=FetchType.LAZY)
@Column(name="ELITE")
- private boolean getEliteClub () { ... }
- public void setEliteClub (boolean elite) { ... }
+ private boolean getEliteClub() { ... }
+ public void setEliteClub(boolean elite) { ... }
...
}
@@ -4593,8 +4593,8 @@
extends Subscription {
@Column(name="END")
- public Date getEndDate () { ... }
- public void setEndDate (Date end) { ... }
+ public Date getEndDate() { ... }
+ public void setEndDate(Date end) { ... }
...
}
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_pc.xml Wed Jul 29 20:36:20 2009
@@ -1290,7 +1290,7 @@
@PostPersist
public void logAddition(Object pc) {
- getLog ().debug ("Added new magazine:" + ((Magazine) pc).getTitle ());
+ getLog().debug("Added new magazine:" + ((Magazine) pc).getTitle());
}
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_overview_sqlquery.xml Wed Jul 29 20:36:20 2009
@@ -233,7 +233,7 @@
List<Magazine> results = (List<Magazine>) query.getResultList();
for (Magazine mag : results)
- processMagazine (mag);
+ processMagazine(mag);
</programlisting>
</example>
<para>
Modified: openjpa/trunk/openjpa-project/src/doc/manual/jpa_tutorials.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/jpa_tutorials.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/jpa_tutorials.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/jpa_tutorials.xml Wed Jul 29 20:36:20 2009
@@ -526,11 +526,11 @@
* @param cls the class of animal to query on
* @param em the EntityManager to obtain the query from
*/
- public static List getAnimals (String filter, EntityManager em)
+ public static List getAnimals(String filter, EntityManager em)
{
// Execute a query for the specified filter.
- Query query = em.createQuery (filter);
- return query.getResultList ();
+ Query query = em.createQuery(filter);
+ return query.getResultList();
}
</programlisting>
</listitem>
@@ -612,17 +612,17 @@
*
* @param object the object to persist in the data store
*/
- public static void persistObject (EntityManager em, Object object)
+ public static void persistObject(EntityManager em, Object object)
{
// Mark the beginning of the unit of work boundary.
- em.getTransaction ().begin ();
+ em.getTransaction().begin();
- em.persist (object);
+ em.persist(object);
// Mark the end of the unit of work boundary,
// and record all inserts in the database.
- em.getTransaction ().commit ();
- System.out.println ("Added " + object);
+ em.getTransaction().commit();
+ System.out.println("Added " + object);
}
</programlisting>
<note>
@@ -694,21 +694,21 @@
* @param objects the objects to persist in the datastore
* @param em the EntityManager to delete with
*/
- public static void deleteObjects (Collection objects, EntityManager em)
+ public static void deleteObjects(Collection objects, EntityManager em)
{
// Mark the beginning of the unit of work boundary.
- em.getTransaction ().begin ();
+ em.getTransaction().begin();
// This method removes the objects in 'objects' from the data store.
for (Object ob : objects)
{
- System.out.println ("Removed animal: " + ob);
- em.remove (ob);
+ System.out.println("Removed animal: " + ob);
+ em.remove(ob);
}
// Mark the end of the unit of work boundary, and record all
// deletes in the database.
- em.getTransaction ().commit ();
+ em.getTransaction().commit();
}
</programlisting>
</listitem>
@@ -981,27 +981,27 @@
<xref linkend="jpa_overview_mapping_field"/> of the JPA Overview.
</para>
<para>
-Modify the <literal>toString (boolean)</literal> method to output the giTract
+Modify the <literal>toString(boolean)</literal> method to output the giTract
list.
</para>
<programlisting>
- public String toString (boolean detailed)
+ public String toString(boolean detailed)
{
- StringBuffer buf = new StringBuffer (1024);
- buf.append ("Snake ").append (getName ());
+ StringBuffer buf = new StringBuffer(1024);
+ buf.append("Snake ").append(getName());
if (detailed)
{
- buf.append (" (").append (length).append (" feet long) sells for ");
- buf.append (getPrice ()).append (" dollars.");
- buf.append (" Its gastrointestinal tract contains:\n");
+ buf.append(" (").append(length).append(" feet long) sells for ");
+ buf.append(getPrice()).append(" dollars.");
+ buf.append(" Its gastrointestinal tract contains:\n");
for (Rabbit rabbit : giTract)
- buf.append ("\t").append (rabbit).append ("\n");
+ buf.append("\t").append(rabbit).append("\n");
}
else
- buf.append ("; ate " + giTract.size () + " rabbits.");
+ buf.append("; ate " + giTract.size() + " rabbits.");
- return buf.toString ();
+ return buf.toString();
}
</programlisting>
<para>
@@ -1011,75 +1011,75 @@
/**
* Kills the specified rabbit and eats it.
*/
- public void eat (Rabbit dinner)
+ public void eat(Rabbit dinner)
{
// Consume the rabbit.
- dinner.kill ();
- dinner.setEater (this);
- giTract.add (dinner);
- System.out.println ("Snake " + getName () + " ate rabbit "
- + dinner.getName () + ".");
+ dinner.kill();
+ dinner.setEater(this);
+ giTract.add(dinner);
+ System.out.println("Snake " + getName() + " ate rabbit "
+ + dinner.getName() + ".");
}
/**
* Locates the specified snake and tells it to eat a rabbit.
*/
- public static void eat (EntityManager em, String filter)
+ public static void eat(EntityManager em, String filter)
{
- em.getTransaction ().begin ();
+ em.getTransaction().begin();
// Find the desired snake(s) in the data store.
- Query query = em.createQuery (filter);
- List<Snake> results = query.getResultList ();
- if (results.isEmpty ())
+ Query query = em.createQuery(filter);
+ List<Snake> results = query.getResultList();
+ if (results.isEmpty())
{
- System.out.println ("No snakes matching '" + filter + "' found");
+ System.out.println("No snakes matching '" + filter + "' found");
return;
}
Query uneatenQuery = em.createQuery
("select r from Rabbit r where r.isDead = false");
- Random random = new Random ();
+ Random random = new Random();
for (Snake snake : results)
{
// Run a query for a rabbit whose 'isDead' field indicates
// that it is alive.
- List<Rabbit> menu = uneatenQuery.getResultList ();
- if (menu.isEmpty ())
+ List<Rabbit> menu = uneatenQuery.getResultList();
+ if (menu.isEmpty())
{
- System.out.println ("No live rabbits in DB.");
+ System.out.println("No live rabbits in DB.");
break;
}
// Select a random rabbit from the list.
- Rabbit dinner = menu.get (random.nextInt (menu.size ()));
+ Rabbit dinner = menu.get(random.nextInt(menu.size()));
// Perform the eating.
- System.out.println (snake + " is eating:");
- snake.eat (dinner);
+ System.out.println(snake + " is eating:");
+ snake.eat(dinner);
}
- em.getTransaction ().commit ();
+ em.getTransaction().commit();
}
- public static void main (String[] args)
+ public static void main(String[] args)
{
- if (args.length == 2 && args[0].equals ("eat"))
+ if (args.length == 2 && args[0].equals("eat"))
{
EntityManagerFactory emf = Persistence.
- createEntityManagerFactory (null);
- EntityManager em = emf.createEntityManager ();
- eat (em, args[1]);
- em.close ();
- emf.close ();
+ createEntityManagerFactory(null);
+ EntityManager em = emf.createEntityManager();
+ eat(em, args[1]);
+ em.close();
+ emf.close();
return;
}
// If we get here, something went wrong.
- System.out.println ("Usage:");
- System.out.println (" java tutorial.persistence.Snake eat "
+ System.out.println("Usage:");
+ System.out.println(" java tutorial.persistence.Snake eat "
+ "\"snakequery\"");
}
</programlisting>
@@ -1095,13 +1095,13 @@
...
- public Snake getEater ()
+ public Snake getEater()
{
return eater;
}
- public void setEater (Snake snake)
+ public void setEater(Snake snake)
{
eater = snake;
}
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_caching.xml Wed Jul 29 20:36:20 2009
@@ -707,7 +707,7 @@
Query q = em.createQuery(...).
setParameter(0, paramVal0).
setParameter(1, paramVal1);
-qcache.evict (q);
+qcache.evict(q);
</programlisting>
</example>
<para>
@@ -777,7 +777,7 @@
// temporarily disable query caching for all queries created from em
OpenJPAEntityManager oem = OpenJPAPersistence.cast(em);
-oem.getFetchPlan ().setQueryResultCacheEnabled(false);
+oem.getFetchPlan().setQueryResultCacheEnabled(false);
// re-enable caching for a particular query
OpenJPAQuery oq = oem.createQuery(...);
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_dbsetup.xml Wed Jul 29 20:36:20 2009
@@ -3708,7 +3708,7 @@
Query q = em.createQuery("select m from Magazine m where m.title = 'JDJ'");
OpenJPAQuery kq = OpenJPAPersistence.cast(q);
-JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan ();
+JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
fetch.setJoinSyntax(JoinSyntax.SQL92);
List results = q.getResultList();
</programlisting>
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_logging.xml Wed Jul 29 20:36:20 2009
@@ -507,7 +507,7 @@
private String _prefix = "CUSTOM LOG";
- public void setPrefix (String prefix) {
+ public void setPrefix(String prefix) {
_prefix = prefix;
}
@@ -522,7 +522,7 @@
return true;
}
- protected void log (short type, String message, Throwable t) {
+ protected void log(short type, String message, Throwable t) {
// just send everything to System.err
System.err.println(_prefix + ": " + type + ": "
+ message + ": " + t);
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_pc.xml Wed Jul 29 20:36:20 2009
@@ -1759,7 +1759,7 @@
... logic to pack custom type into a list of authors ...
}
- public static CustomType authorsToCustomType (Collection authors) {
+ public static CustomType authorsToCustomType(Collection authors) {
... logic to create custom type from a collection of authors ...
}
Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml?rev=799064&r1=799063&r2=799064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_runtime.xml Wed Jul 29 20:36:20 2009
@@ -347,7 +347,7 @@
OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
Extent<Magazine> mags = kem.createExtent(Magazine.class, false);
for (Magazine m : mags)
- processMagazine (m);
+ processMagazine(m);
</programlisting>
</example>
</section>
@@ -619,7 +619,7 @@
Query q = em.createQuery("select s from Stock s where symbol = :s");
q.setParameter("s", symbol);
OpenJPAQuery oq = OpenJPAPersistence.cast(q);
-FetchPlan fetch = oq.getFetchPlan ();
+FetchPlan fetch = oq.getFetchPlan();
fetch.setReadLockMode(LockModeType.WRITE);
fetch.setLockTimeout(3000); // 3 seconds
Stock stock = (Stock) q.getSingleResult();
@@ -693,7 +693,7 @@
...
oem.setOptimistic(true);
-oem.getTransaction().begin ();
+oem.getTransaction().begin();
// override default of not locking during an opt trans to lock stock object
oem.lock(stock, LockModeType.WRITE, 1000);
@@ -1139,8 +1139,8 @@
Basic Filter Extension
</title>
<programlisting>
-Query q = em.createQuery ("select c from City c where c.name.ext:firstThreeChars () = 'Har'");
-List results = q.getResultList ();
+Query q = em.createQuery("select c from City c where c.name.ext:firstThreeChars () = 'Har'");
+List results = q.getResultList();
</programlisting>
</example>
<para>
@@ -1153,9 +1153,9 @@
Chaining Filter Extensions
</title>
<programlisting>
-Query query = em.createQuery ("select c from City c where "
+Query query = em.createQuery("select c from City c where "
+ "c.name.ext:firstThreeChars ().ext:equalsIgnoreCase ('Har')");
-List results = q.getResultList ();
+List results = q.getResultList();
</programlisting>
</example>
<para>