[Tynstep-svn] r259 - in trunk/step: step-core/src/main/java/com/tyndalehouse/step/core/data/common step-core/src/main/java/com/tyndalehouse/step/core/data/create step-core/src/main/java/com/tyndalehouse/step/core/data/entities step-core/src/main/java/com/tyndalehouse/step/core/guice step-core/src/main/java/com/tyndalehouse/step/core/guice/providers step-core/src/main/java/com/tyndalehouse/step/core/service step-core/src/main/java/com/tyndalehouse/step/core/service/impl step-core/src/test/java/com/tyndalehouse/step/core/scratch step-core/src/test/java/com/tyndalehouse/step/core/service/impl step-web/src/main/java/com/tyndalehouse/step/guice step-web/src/main/java/com/tyndalehouse/step/models step-web/src/main/java/com/tyndalehouse/step/models/timeline/simile step-web/src/main/java/com/tyndalehouse/step/rest/controllers step-web/src/main/webapp step-web/src/main/webapp/css step-web/src/main/webapp/js step-web/src/main/webapp/libs step-web/src/test/java/com/tyndalehouse/step/rest/controllers
ChrisBurrell at crosswire.org
ChrisBurrell at crosswire.org
Wed Apr 25 10:05:24 MST 2012
Author: ChrisBurrell
Date: 2012-04-25 10:05:23 -0700 (Wed, 25 Apr 2012)
New Revision: 259
Added:
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/StrongDefinition.java
Removed:
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/RelationalPerson.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/RelationalPeopleService.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImpl.java
trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImplTest.java
Modified:
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/common/PartialDate.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/create/GeographyModuleLoader.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/GeoPlace.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureReference.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureTarget.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/StepCoreModule.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/TestData.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/BibleInformationServiceImpl.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java
trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/TimelineServiceImpl.java
trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/scratch/ScratchTest.java
trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImplTest.java
trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java
trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/WebSessionImpl.java
trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/timeline/simile/SimileEvent.java
trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/BibleController.java
trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/TimelineController.java
trunk/step/step-web/src/main/webapp/css/initial-fonts.css
trunk/step/step-web/src/main/webapp/js/init.js
trunk/step/step-web/src/main/webapp/js/passage.js
trunk/step/step-web/src/main/webapp/js/top_menu.js
trunk/step/step-web/src/main/webapp/libs/jquery-shout.js
trunk/step/step-web/src/main/webapp/topmenu.html
trunk/step/step-web/src/test/java/com/tyndalehouse/step/rest/controllers/BibleControllerTest.java
Log:
committing bridge option - as a menu option, not a button
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/common/PartialDate.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/common/PartialDate.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/common/PartialDate.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -4,8 +4,6 @@
import static org.apache.commons.lang.StringUtils.isEmpty;
import static org.apache.commons.lang.StringUtils.split;
-import java.util.Calendar;
-
import org.apache.commons.lang.StringUtils;
import org.joda.time.LocalDateTime;
@@ -85,7 +83,6 @@
* @return the newly created PartialDate
*/
private static PartialDate getPartialDateFromArray(final String[] parts, final boolean negativeDate) {
- final Calendar c = Calendar.getInstance();
final LocalDateTime translatedTime;
PrecisionType p;
final int multiplier = negativeDate ? -1 : 1;
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/create/GeographyModuleLoader.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/create/GeographyModuleLoader.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/create/GeographyModuleLoader.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -29,6 +29,12 @@
*
*/
public class GeographyModuleLoader implements ModuleLoader {
+ private static final int PLACE_NAME_FIELD = 0;
+ private static final int ROOT_FIELD = 1;
+ private static final int LATITUDE_FIELD = 2;
+ private static final int LONGITUDE_FIELD = 3;
+ private static final int SCRIPTURE_FIELD = 4;
+ private static final int COMMENT_FIELD = 5;
private static final String OPENBIBLE_DATA = "geography/openbible.tab";
private static final Logger LOG = LoggerFactory.getLogger(GeographyModuleLoader.class);
private static final int IGNORE_LINES = 1;
@@ -88,16 +94,17 @@
final String[] geoFields = StringUtils.splitPreserveAllTokens(geoLine, '\t');
final GeoPlace gp = new GeoPlace();
- gp.setEsvName(geoFields[0]);
- gp.setRoot(geoFields[1]);
- setCoordinates(gp, geoFields[2], geoFields[3]);
+ gp.setEsvName(geoFields[PLACE_NAME_FIELD]);
+ gp.setRoot(geoFields[ROOT_FIELD]);
+ setCoordinates(gp, geoFields[LATITUDE_FIELD], geoFields[LONGITUDE_FIELD]);
final List<ScriptureReference> passageReferences = this.jsword
- .getPassageReferences(geoFields[4].replace(',', ';').replace("Sng", "Song"));
+ .getPassageReferences(geoFields[SCRIPTURE_FIELD].replace(',', ';').replace("Sng",
+ "Song"));
gp.setReferences(passageReferences);
- gp.setComment(geoFields[5]);
+ gp.setComment(geoFields[COMMENT_FIELD]);
- LOG.trace("Adding [{}] [{}]", gp.getEsvName(), geoFields[4]);
+ LOG.trace("Adding [{}] [{}]", gp.getEsvName(), geoFields[PLACE_NAME_FIELD]);
places.add(gp);
LOG.trace("Added [{}] [{}]", gp.getId(), gp.getEsvName());
@@ -144,7 +151,6 @@
LOG.trace("Parsing value coordinate [{}]", coordinate);
while (ii < coordLength && !Character.isDigit(coordinate.charAt(ii))) {
// do something with the characters we find
-
ii++;
}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/GeoPlace.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/GeoPlace.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/GeoPlace.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -21,14 +21,15 @@
@Entity
public class GeoPlace extends ScriptureTarget implements Serializable {
private static final long serialVersionUID = -3798208225083529282L;
+ private static final int COORDINATE_PRECISION = 17;
@Column
private String esvName;
@Column
private String root;
- @Column(precision = 17)
+ @Column(precision = COORDINATE_PRECISION)
private Double latitude;
- @Column(precision = 17)
+ @Column(precision = COORDINATE_PRECISION)
private Double longitude;
@Column
private String comment;
Deleted: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/RelationalPerson.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/RelationalPerson.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/RelationalPerson.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -1,111 +0,0 @@
-package com.tyndalehouse.step.core.data.entities;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-
-import com.avaje.ebean.annotation.CacheStrategy;
-
-/**
- * An entity representing a particular geographical location
- *
- * @author cjburrell
- *
- */
- at CacheStrategy(readOnly = true)
- at Entity
-public class RelationalPerson extends ScriptureTarget implements Serializable, KeyedEntity {
- private static final long serialVersionUID = -3798208225083529282L;
-
- @Column
- private String name;
-
- @Column
- @OneToOne(cascade = CascadeType.PERSIST)
- private RelationalPerson father;
-
- @Column
- @OneToOne(cascade = CascadeType.PERSIST)
- private RelationalPerson mother;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "relationalPerson")
- private List<ScriptureReference> references;
-
- @Column(unique = true)
- private String code;
-
- /**
- * @return the name
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(final String name) {
- this.name = name;
- }
-
- /**
- * @return the father
- */
- public RelationalPerson getFather() {
- return this.father;
- }
-
- /**
- * @param father the father to set
- */
- public void setFather(final RelationalPerson father) {
- this.father = father;
- }
-
- /**
- * @return the mother
- */
- public RelationalPerson getMother() {
- return this.mother;
- }
-
- /**
- * @param mother the mother to set
- */
- public void setMother(final RelationalPerson mother) {
- this.mother = mother;
- }
-
- /**
- * @return the references
- */
- public List<ScriptureReference> getReferences() {
- return this.references;
- }
-
- /**
- * @param references the references to set
- */
- public void setReferences(final List<ScriptureReference> references) {
- this.references = references;
- }
-
- /**
- * @return the code
- */
- public String getCode() {
- return this.code;
- }
-
- /**
- * @param code the code to set
- */
- public void setCode(final String code) {
- this.code = code;
- }
-}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureReference.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureReference.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureReference.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -31,10 +31,6 @@
@Column(nullable = true)
private TimelineEvent timelineEvent;
- @ManyToOne(optional = true)
- @Column(nullable = true)
- private RelationalPerson relationalPerson;
-
@Column
private TargetType targetType;
@@ -127,18 +123,4 @@
public void setTimelineEvent(final TimelineEvent timelineEvent) {
this.timelineEvent = timelineEvent;
}
-
- /**
- * @return the relationalPerson
- */
- public RelationalPerson getRelationalPerson() {
- return this.relationalPerson;
- }
-
- /**
- * @param relationalPerson the relationalPerson to set
- */
- public void setRelationalPerson(final RelationalPerson relationalPerson) {
- this.relationalPerson = relationalPerson;
- }
}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureTarget.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureTarget.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/ScriptureTarget.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -12,8 +12,10 @@
* @author Chris
*
*/
+// CHECKSTYLE:OFF
@MappedSuperclass
public abstract class ScriptureTarget implements Serializable {
+ // CHECKSTYLE:ON
private static final long serialVersionUID = 1598422350749055247L;
@Id
Added: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/StrongDefinition.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/StrongDefinition.java (rev 0)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/StrongDefinition.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -0,0 +1,24 @@
+package com.tyndalehouse.step.core.data.entities;
+
+import javax.persistence.Entity;
+
+import com.avaje.ebean.annotation.CacheStrategy;
+
+/**
+ * A entitiy representing what we expect to see in a strong definition
+ *
+ * @author Chris
+ *
+ */
+ at CacheStrategy(readOnly = true)
+ at Entity
+public class StrongDefinition {
+ private String originalLanguage;
+ private String transliteration;
+ private String pronunciation;
+ private String kjvDefinition;
+ private String strongs_derivation;
+ private String lexicon_summary;
+
+
+}
Property changes on: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/data/entities/StrongDefinition.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/StepCoreModule.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/StepCoreModule.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/StepCoreModule.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -30,7 +30,6 @@
import com.tyndalehouse.step.core.service.GeographyService;
import com.tyndalehouse.step.core.service.JSwordService;
import com.tyndalehouse.step.core.service.ModuleService;
-import com.tyndalehouse.step.core.service.RelationalPeopleService;
import com.tyndalehouse.step.core.service.TimelineService;
import com.tyndalehouse.step.core.service.UserDataService;
import com.tyndalehouse.step.core.service.impl.BibleInformationServiceImpl;
@@ -38,7 +37,6 @@
import com.tyndalehouse.step.core.service.impl.GeographyServiceImpl;
import com.tyndalehouse.step.core.service.impl.JSwordServiceImpl;
import com.tyndalehouse.step.core.service.impl.ModuleServiceImpl;
-import com.tyndalehouse.step.core.service.impl.RelationalPeopleServiceImpl;
import com.tyndalehouse.step.core.service.impl.TimelineServiceImpl;
import com.tyndalehouse.step.core.service.impl.UserDataServiceImpl;
@@ -67,7 +65,6 @@
bind(GeographyService.class).to(GeographyServiceImpl.class);
bind(FavouritesService.class).to(FavouritesServiceImpl.class);
bind(UserDataService.class).to(UserDataServiceImpl.class);
- bind(RelationalPeopleService.class).to(RelationalPeopleServiceImpl.class);
bind(Loader.class);
bind(Session.class).toProvider(ServerSessionProvider.class);
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/DatabaseConfigProvider.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -12,10 +12,10 @@
import com.tyndalehouse.step.core.data.entities.GeoPlace;
import com.tyndalehouse.step.core.data.entities.History;
import com.tyndalehouse.step.core.data.entities.HotSpot;
-import com.tyndalehouse.step.core.data.entities.RelationalPerson;
import com.tyndalehouse.step.core.data.entities.ScriptureReference;
import com.tyndalehouse.step.core.data.entities.ScriptureTarget;
import com.tyndalehouse.step.core.data.entities.Session;
+import com.tyndalehouse.step.core.data.entities.StrongDefinition;
import com.tyndalehouse.step.core.data.entities.TimelineEvent;
import com.tyndalehouse.step.core.data.entities.User;
import com.tyndalehouse.step.core.data.entities.aggregations.TimelineEventsAndDate;
@@ -115,7 +115,6 @@
// timeline entities
config.addClass(ScriptureTarget.class);
config.addClass(ScriptureReference.class);
- config.addClass(RelationalPerson.class);
config.addClass(HotSpot.class);
config.addClass(TimelineEvent.class);
config.addClass(User.class);
@@ -124,6 +123,7 @@
config.addClass(History.class);
config.addClass(GeoPlace.class);
config.addClass(TimelineEventsAndDate.class);
+ config.addClass(StrongDefinition.class);
}
/**
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/TestData.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/TestData.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/guice/providers/TestData.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -40,6 +40,7 @@
* @param numCryptoIterations the number of iterations to perform - we need since we hook in to the user
* data service from a different viewpoint
* @param loader the loader that should be called upon installation mainly
+ * @param coreModules a comma-separated list of core modules
* @param jsword jsword services
*/
@Inject
Deleted: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/RelationalPeopleService.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/RelationalPeopleService.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/RelationalPeopleService.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -1,19 +0,0 @@
-package com.tyndalehouse.step.core.service;
-
-import com.tyndalehouse.step.core.data.entities.RelationalPerson;
-
-/**
- *
- * @author cjburrell
- *
- */
-public interface RelationalPeopleService {
- /**
- * Obtains a list of all people for a particular reference
- *
- * @param name the reference
- * @param degree the number of links to retrieve
- * @return the list of people
- */
- RelationalPerson getGenealogy(String name, int degree);
-}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/BibleInformationServiceImpl.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/BibleInformationServiceImpl.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/BibleInformationServiceImpl.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -47,7 +47,7 @@
@Override
public List<BibleVersion> getAvailableBibleVersions(final boolean allVersions, final String locale) {
- LOGGER.info("Getting bible versions");
+ LOGGER.info("Getting bible versions with locale [{}] and allVersions=[{}]", locale, allVersions);
return getSortedSerialisableList(this.jsword.getInstalledModules(allVersions, locale,
BookCategory.BIBLE));
}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImpl.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import javax.xml.transform.TransformerException;
@@ -80,12 +81,21 @@
}
@Override
- public List<Book> getInstalledModules(final boolean allVersions, final String locale,
+ public List<Book> getInstalledModules(final boolean allVersions, final String language,
final BookCategory... bibleCategory) {
+
if (!allVersions) {
- notNull(locale, "Locale was not passed by requester");
+ notNull(language, "Locale was not passed by requester");
}
+ // TODO : TOTOTOTOTOTOTOTO
+ final String tempLang;
+ if ("eng".equals(language)) {
+ tempLang = "en";
+ } else {
+ tempLang = language;
+ }
+
if (bibleCategory == null || bibleCategory.length == 0) {
return new ArrayList<Book>();
}
@@ -102,15 +112,25 @@
@SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation")
public boolean test(final Book b) {
return categories.contains(b.getBookCategory())
- && (allVersions || ANCIENT_GREEK.equals(b.getLanguage().getCode())
- || ANCIENT_HEBREW.equals(b.getLanguage().getCode()) || locale.equals(b
- .getLanguage().getCode()));
+ && (allVersions || isAcceptableVersions(b, tempLang));
}
+
};
return Books.installed().getBooks(bf);
}
/**
+ * @param locale the language we are interested in
+ * @param book the book we are testing
+ * @return true if we are to accept the book
+ */
+ private boolean isAcceptableVersions(final Book book, final String locale) {
+ return ANCIENT_GREEK.equals(book.getLanguage().getCode())
+ || ANCIENT_HEBREW.equals(book.getLanguage().getCode())
+ || locale.equals(book.getLanguage().getCode());
+ }
+
+ /**
* @param bibleCategory the categories of books that should be considered
* @return returns a list of installed modules
*/
@@ -417,7 +437,7 @@
* @return the list of matching names
*/
private List<String> getBooksFromVersification(final String bookStart, final Versification versification) {
- final String searchPattern = bookStart.toLowerCase();
+ final String searchPattern = bookStart.toLowerCase(Locale.getDefault());
final List<String> matchingNames = new ArrayList<String>();
final BibleBookList books = versification.getBooks();
Deleted: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImpl.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImpl.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImpl.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -1,57 +0,0 @@
-package com.tyndalehouse.step.core.service.impl;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.avaje.ebean.EbeanServer;
-import com.google.inject.Inject;
-import com.tyndalehouse.step.core.data.entities.RelationalPerson;
-import com.tyndalehouse.step.core.service.JSwordService;
-import com.tyndalehouse.step.core.service.RelationalPeopleService;
-
-/**
- * An implementation that retrieves the relational people/genealogy data
- *
- * @author cjburrell
- *
- */
-public class RelationalPeopleServiceImpl implements RelationalPeopleService {
- private static final String FETCH_SEPARATOR = ".";
- private static final Logger LOG = LoggerFactory.getLogger(RelationalPeopleServiceImpl.class);
- private final EbeanServer ebean;
- private final JSwordService jsword;
-
- /**
- * creates a new Geography service implementation
- *
- * @param ebean ebean server
- * @param jsword the jsword service for access to Crosswire functionality
- */
- @Inject
- public RelationalPeopleServiceImpl(final EbeanServer ebean, final JSwordService jsword) {
- this.ebean = ebean;
- this.jsword = jsword;
- }
-
- @Override
- public RelationalPerson getGenealogy(final String name, final int degree) {
- final StringBuilder father = new StringBuilder();
- final StringBuilder mother = new StringBuilder();
- for (int ii = 0; ii < degree; ii++) {
- father.append("father");
- mother.append("mother");
-
- if (ii < degree - 1) {
- father.append(FETCH_SEPARATOR);
- mother.append(FETCH_SEPARATOR);
- }
- }
-
- final String fatherFetch = father.toString();
- final String motherFetch = mother.toString();
- LOG.trace("Going to fetch [{}], [{}]", fatherFetch, motherFetch);
-
- return this.ebean.find(RelationalPerson.class).fetch(fatherFetch).fetch(motherFetch).where().eq(
- "code", name).findUnique();
- }
-}
Modified: trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/TimelineServiceImpl.java
===================================================================
--- trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/TimelineServiceImpl.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/main/java/com/tyndalehouse/step/core/service/impl/TimelineServiceImpl.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -99,7 +99,7 @@
// first get the kjv reference
final List<ScriptureReference> passageReferences = this.jsword.getPassageReferences(reference);
- if (passageReferences.size() == 0) {
+ if (passageReferences.isEmpty()) {
return new ArrayList<TimelineEvent>();
}
Modified: trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/scratch/ScratchTest.java
===================================================================
--- trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/scratch/ScratchTest.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/scratch/ScratchTest.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -31,9 +31,13 @@
// }
//
// }
-
+ /**
+ * a placeholder test to allow developers to write and comment out tests in this class
+ *
+ */
@Test
public void simpleTest() {
+ // NO-OP
}
}
Modified: trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImplTest.java
===================================================================
--- trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImplTest.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/JSwordServiceImplTest.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -267,13 +267,20 @@
// }
}
- @Test
- public void testPrettyXml() throws BookException, NoSuchKeyException, JDOMException, IOException {
- final Book currentBook = Books.installed().getBook("ESV");
- final BookData bookData = new BookData(currentBook, currentBook.getKey("Exodus 3:14"));
- final Element osisFragment = bookData.getOsisFragment();
-
- final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat());
- LOGGER.debug(xmlOutputter.outputString(osisFragment));
- }
+ // /**
+ // * Outputs pretty xml
+ // * @throws BookException
+ // * @throws NoSuchKeyException
+ // * @throws JDOMException
+ // * @throws IOException
+ // */
+ // @Test
+ // public void testPrettyXml() throws BookException, NoSuchKeyException, JDOMException, IOException {
+ // final Book currentBook = Books.installed().getBook("ESV");
+ // final BookData bookData = new BookData(currentBook, currentBook.getKey("Exodus 3:14"));
+ // final Element osisFragment = bookData.getOsisFragment();
+ //
+ // final XMLOutputter xmlOutputter = new XMLOutputter(Format.getPrettyFormat());
+ // LOGGER.debug(xmlOutputter.outputString(osisFragment));
+ // }
}
Deleted: trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImplTest.java
===================================================================
--- trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImplTest.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-core/src/test/java/com/tyndalehouse/step/core/service/impl/RelationalPeopleServiceImplTest.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -1,68 +0,0 @@
-package com.tyndalehouse.step.core.service.impl;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.runners.MockitoJUnitRunner;
-
-import com.tyndalehouse.step.core.data.DataDrivenTestExtension;
-import com.tyndalehouse.step.core.data.entities.RelationalPerson;
-
-/**
- * tests the geography data retrieval queries
- *
- * @author Chris
- *
- */
- at RunWith(MockitoJUnitRunner.class)
-public class RelationalPeopleServiceImplTest extends DataDrivenTestExtension {
- /**
- * Tests the successful path of registering a user
- */
- @Test
- public void testGetPeople() {
- final RelationalPerson abraham = new RelationalPerson();
- final RelationalPerson sarah = new RelationalPerson();
- final RelationalPerson isaac = new RelationalPerson();
- final RelationalPerson ishmael = new RelationalPerson();
- final RelationalPerson rebekah = new RelationalPerson();
- final RelationalPerson esau = new RelationalPerson();
- final RelationalPerson jacob = new RelationalPerson();
- final RelationalPerson hagar = new RelationalPerson();
-
- abraham.setCode("abraham");
- sarah.setCode("sarah");
- isaac.setCode("isaac");
- ishmael.setCode("ishmael");
- rebekah.setCode("rebekah");
- esau.setCode("esau");
- jacob.setCode("jacob");
- hagar.setCode("hagar");
-
- esau.setFather(isaac);
- esau.setMother(rebekah);
- jacob.setFather(isaac);
- jacob.setMother(rebekah);
-
- isaac.setFather(abraham);
- isaac.setMother(sarah);
- ishmael.setFather(abraham);
- ishmael.setMother(hagar);
-
- getEbean().save(abraham);
- getEbean().save(sarah);
- getEbean().save(isaac);
- getEbean().save(ishmael);
- getEbean().save(rebekah);
- getEbean().save(esau);
- getEbean().save(jacob);
- getEbean().save(hagar);
-
- final RelationalPeopleServiceImpl people = new RelationalPeopleServiceImpl(getEbean(),
- new JSwordServiceImpl(null));
-
- final RelationalPerson esauTree = people.getGenealogy("esau", 1);
- Assert.assertNotNull(esauTree.getFather());
-
- }
-}
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/guice/StepServletConfig.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -25,19 +25,16 @@
*
*/
public class StepServletConfig extends GuiceServletContextListener {
- private final Logger LOGGER = LoggerFactory.getLogger(StepServletConfig.class);
- private Injector injector;
+ private static final Logger LOGGER = LoggerFactory.getLogger(StepServletConfig.class);
@Override
protected Injector getInjector() {
- this.injector = Guice.createInjector(new StepCoreModule(), new WebContextModule(),
- new ServletModule() {
- @Override
- protected void configureServlets() {
- serve("/rest/*").with(FrontController.class);
- }
- });
- return this.injector;
+ return Guice.createInjector(new StepCoreModule(), new WebContextModule(), new ServletModule() {
+ @Override
+ protected void configureServlets() {
+ serve("/rest/*").with(FrontController.class);
+ }
+ });
}
@Override
@@ -57,9 +54,9 @@
try {
DriverManager.deregisterDriver(driver);
- this.LOGGER.info("Deregistering Jdbc driver: {}", driver);
+ LOGGER.info("Deregistering Jdbc driver: {}", driver);
} catch (final SQLException e) {
- this.LOGGER.error("Error deregistering driver " + driver.toString(), e);
+ LOGGER.error("Error deregistering driver " + driver.toString(), e);
}
}
}
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/WebSessionImpl.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/WebSessionImpl.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/WebSessionImpl.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -17,6 +17,7 @@
* creates a web session
*
* @param id the id of the session
+ * @param language the ISO 3-character long language name
*/
public WebSessionImpl(final String id, final String language) {
this.sessionId = id;
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/timeline/simile/SimileEvent.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/timeline/simile/SimileEvent.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/models/timeline/simile/SimileEvent.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -26,8 +26,8 @@
private int hotSpotId;
private int eventId;
- private String image; // ? should be url? TODO
- private String link; // ? should be url
+ private String image;
+ private String link;
/**
* @return the start
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/BibleController.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/BibleController.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/BibleController.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -41,7 +41,9 @@
* creates the controller giving access to bible information
*
* @param bibleInformation the service allowing access to biblical material
- * @param serverSession session
+ * @param serverSession server-side stored session
+ * @param clientSession clientSession given on the request
+ *
*/
@Inject
public BibleController(final BibleInformationService bibleInformation,
Modified: trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/TimelineController.java
===================================================================
--- trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/TimelineController.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/java/com/tyndalehouse/step/rest/controllers/TimelineController.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -1,5 +1,7 @@
package com.tyndalehouse.step.rest.controllers;
+import static org.apache.commons.lang.Validate.notNull;
+
import java.util.List;
import org.joda.time.LocalDateTime;
@@ -37,6 +39,8 @@
@Inject
public TimelineController(final TimelineService timelineService,
final UserInterfaceTranslator<TimelineEvent, DigestableTimeline> translator) {
+ notNull(timelineService, "Timeline service was null");
+ notNull(translator, "Translator was null");
this.timelineService = timelineService;
this.translator = translator;
}
@@ -52,6 +56,8 @@
*/
@Cacheable(true)
public DigestableTimeline getEventsFromReference(final String bibleReference) {
+ LOGGER.debug("Getting events for scripture [{}]", bibleReference);
+
final TimelineEventsAndDate eventsFromScripture = this.timelineService
.getEventsFromScripture(bibleReference);
return this.translator.toDigestableForm(eventsFromScripture.getEvents(),
@@ -70,6 +76,8 @@
*/
@Cacheable(true)
public DigestableTimeline getEventsInPeriod(final String from, final String to) {
+ LOGGER.debug("Getting events between [{}] and [{}]", from, to);
+
return this.translator.toDigestableForm(this.timelineService.getTimelineEvents(
convertJavascriptDate(from), convertJavascriptDate(to)), null);
}
@@ -91,6 +99,8 @@
*/
@Cacheable(true)
public List<HotSpot> getTimelineConfiguration() {
+ LOGGER.debug("Returning timeline configuration");
+
return this.timelineService.getTimelineConfiguration();
}
}
Modified: trunk/step/step-web/src/main/webapp/css/initial-fonts.css
===================================================================
--- trunk/step/step-web/src/main/webapp/css/initial-fonts.css 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/css/initial-fonts.css 2012-04-25 17:05:23 UTC (rev 259)
@@ -3,12 +3,6 @@
font-family: Verdana;
}
-
-
-.inactive {
- color: #ccc;
-}
-
.notYetImplemented {
background-color: black !important ;
}
Modified: trunk/step/step-web/src/main/webapp/js/init.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/init.js 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/js/init.js 2012-04-25 17:05:23 UTC (rev 259)
@@ -11,7 +11,6 @@
initMenu();
initGlobalHandlers();
initLayout();
- initDefaultValues();
initLexicon();
initBookmarks();
@@ -96,39 +95,6 @@
});
}
-function initDefaultValues() {
- addDefaultValue($("input.defaultValue"));
-}
-
-var nonIDedInputs = 0;
-function addDefaultValue(inputSelector) {
- var default_values = new Array();
- inputSelector.each(function(index) {
- $(this).addClass("inactive");
- if(this.id == "") {
- this.id = nonIDedInputs++;
- }
- if (!default_values[this.id]) {
- default_values[this.id] = this.value;
- }
- });
-
- inputSelector.focus(function() {
- if (this.value == default_values[this.id]) {
- $(this).removeClass("inactive");
- this.value = '';
- }
-
- $(this).blur(function() {
- if (this.value == '') {
- $(this).addClass("inactive");
- this.value = default_values[this.id];
- }
- });
- });
-
-}
-
/**
* sets up the initial data and passages
*/
Modified: trunk/step/step-web/src/main/webapp/js/passage.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/passage.js 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/js/passage.js 2012-04-25 17:05:23 UTC (rev 259)
@@ -13,6 +13,7 @@
this.passage = $(".passageContent", passageContainer);
this.bookmarkButton = $(".bookmarkPassageLink", passageContainer);
this.passageId = passageId;
+ this.passageSync = false;
//read state from the cookie
this.setInitialPassage();
@@ -32,7 +33,6 @@
//we only care about this event if the menu was within the container...
self.changePassage();
});
-
//register when we want to be alerted that a bookmark has changed
this.passage.hear("new-passage-" + this.passageId, function(selfElement, data) {
@@ -48,6 +48,15 @@
self.bookmarkButton.click();
});
+ this.passage.hear("sync-passage-activated", function(selfElement, data) {
+ self.doSync();
+ });
+
+ this.passage.hear("sync-passage-deactivated", function(selfElement, data) {
+ self.deSync();
+ });
+
+
this.bookmarkButton
.button({ icons: {primary: "ui-icon-bookmark" }, text: false})
.click(function() {
@@ -153,21 +162,53 @@
};
/**
+ * We are forcing a passage sync, which means that we want to change the passage reference text
+ * to match passage-0
+ */
+Passage.prototype.doSync = function() {
+ var self = this;
+ if(this.passageId != 0) {
+ this.passageSync = true;
+ this.reference.attr("disabled", "disabled");
+ this.reference.attr("title", "To view a separate passage on this side of the screen, " +
+ "please use the Options menu and disable the 'Sync both passages' option.");
+ this.changePassage();
+
+ //set up hearer for all new changes
+ this.passage.hear("passage-changed", function(selfElement, data) {
+ if(data.passageId == 0) {
+ self.changePassage();
+ }
+ });
+ }
+};
+
+/**
+ * removes the syncing setting
+ */
+Passage.prototype.deSync = function() {
+ if(this.passageId != 0) {
+ this.passageSync = false;
+ this.reference.removeAttr("disabled");
+ this.reference.removeAttr("title");
+ this.changePassage();
+
+ //unregister hearer
+ this.passage.unhear("passage-changed");
+ }
+};
+
+/**
* changes the passage, with optional parameters
*/
Passage.prototype.changePassage = function() {
- if(this.reference.hasClass("inactive") || this.version.hasClass("inactive")) {
- raiseError("You need to provide both a version and a reference to lookup a passage");
- return;
- }
-
//now get the options from toolbar
var options = this.getSelectedOptions();
var interlinearVersion = this.getSelectedInterlinearVersion();
var self = this;
var lookupVersion = this.version.val();
- var lookupReference = this.reference.val();
+ var lookupReference = this.passageSync ? $(".passageReference").first().val() : this.reference.val();
if(lookupReference && lookupVersion
&& lookupVersion != "" && lookupReference != ""
Modified: trunk/step/step-web/src/main/webapp/js/top_menu.js
===================================================================
--- trunk/step/step-web/src/main/webapp/js/top_menu.js 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/js/top_menu.js 2012-04-25 17:05:23 UTC (rev 259)
@@ -31,6 +31,15 @@
$.shout("version-list-refresh", versions);
});
});
+
+ this.menuRoot.hear("topmenu-SYNC_BOTH_PASSAGES", function(selfElement, enabled) {
+ //alert all passages that we are passage 0 is master
+ if(enabled) {
+ $.shout("sync-passage-activated");
+ } else {
+ $.shout("sync-passage-deactivated");
+ }
+ });
};
/**
Modified: trunk/step/step-web/src/main/webapp/libs/jquery-shout.js
===================================================================
--- trunk/step/step-web/src/main/webapp/libs/jquery-shout.js 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/libs/jquery-shout.js 2012-04-25 17:05:23 UTC (rev 259)
@@ -46,5 +46,14 @@
}
jQuery._jq_shout.registry[eventName].push(item);
});
+ },
+
+ unhear: function(eventName) {
+ var self = this;
+ jQuery.each(jQuery._jq_shout.registry[eventName], function(index, item) {
+ if(item.source == self) {
+ jQuery._jq_shout.registry[eventName].splice(index, 1);
+ }
+ });
}
});
Modified: trunk/step/step-web/src/main/webapp/topmenu.html
===================================================================
--- trunk/step/step-web/src/main/webapp/topmenu.html 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/main/webapp/topmenu.html 2012-04-25 17:05:23 UTC (rev 259)
@@ -9,11 +9,18 @@
</ul>
</li>
+ <li><a href="#">Options</a>
+ <ul>
+ <li><a href="#" name="LIMIT_AVAILABLE_MODULES" onclick="toggleMenuItem(this);">Show Bibles from every language</a></li>
+ <li><a href="#" name="SYNC_BOTH_PASSAGES" onclick="toggleMenuItem(this);">Sync both passages</a></li>
+ </ul>
+ </li>
+
+
<li><a href="#">Tools</a>
<ul>
<li><a href="#" class="notYetImplemented">Install Bibles [Coming soon]</a></li>
<li><a href="#" class="notYetImplemented">Update [Coming soon]</a></li>
- <li><a href="#" name="LIMIT_AVAILABLE_MODULES" onclick="toggleMenuItem(this);">Show Bibles from every language</a></li>
<li><a href="#" class="notYetImplemented">User preferences [Coming soon]</a></li>
</ul>
</li>
Modified: trunk/step/step-web/src/test/java/com/tyndalehouse/step/rest/controllers/BibleControllerTest.java
===================================================================
--- trunk/step/step-web/src/test/java/com/tyndalehouse/step/rest/controllers/BibleControllerTest.java 2012-04-25 12:56:21 UTC (rev 258)
+++ trunk/step/step-web/src/test/java/com/tyndalehouse/step/rest/controllers/BibleControllerTest.java 2012-04-25 17:05:23 UTC (rev 259)
@@ -38,7 +38,7 @@
* sets the test up
*/
@Before
- public void setup() {
+ public void setUp() {
this.testController = new BibleController(this.bibleInformation, this.serverSessionProvider,
this.clientSessionProvider);
}
More information about the Tynstep-svn
mailing list