Skip to content

Commit

Permalink
Merge pull request #828 from WildMeOrg/comment-cleanup
Browse files Browse the repository at this point in the history
Comment cleanup
  • Loading branch information
naknomum authored Oct 15, 2024
2 parents e750cb8 + d58e55f commit 3cde16b
Show file tree
Hide file tree
Showing 147 changed files with 531 additions and 6,183 deletions.
10 changes: 1 addition & 9 deletions devops/deploy/.dockerfiles/nginx/nginx-https.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# this is an UNSUPPORTED file.
# this is an UNSUPPORTED file, but is maintained as a rough template.
# it is only included as possible suggestions for people looking to
# do their own https support using something like certbot to generate the
# certs.

# TODO forward port 80 to https
#server {
#listen 80;
#server_name 0.0.0.0;




server {
listen 443 ssl;
server_name wildbook.example.com;
Expand Down
203 changes: 22 additions & 181 deletions src/main/java/org/ecocean/Annotation.java

Large diffs are not rendered by default.

51 changes: 2 additions & 49 deletions src/main/java/org/ecocean/AnnotationLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
import org.json.JSONObject;

public class AnnotationLite {
/*
should imageId and individualId be stored as UUID? it is 16 bytes vs 36 (string)... but is it slower to convert? TODO
also note: we dont (seem to) need imageId, bbox, or theta, as they are available via the ann already
*/
// private String imageId;
private String individualId = null;
// private int[] bbox;
Expand All @@ -46,25 +41,6 @@ public class AnnotationLite {

public AnnotationLite() {}

/*
public AnnotationLite(Annotation ann) {
this();
if (ann != null) {
if (ann.getMediaAsset() != null) this.setImageId(ann.getMediaAsset().getAcmId());
this.setBbox(ann.getBbox());
this.setTheta(ann.getTheta());
}
}
public AnnotationLite(Annotation ann, String indivId) {
this(ann);
this.setIndividualId(indivId);
}
public AnnotationLite(Annotation ann, String indivId, String tax) {
this(ann);
this.setIndividualId(indivId);
this.setTaxonomy(tax);
}
*/
public AnnotationLite(String indivId) {
this();
this.setIndividualId(indivId);
Expand All @@ -89,29 +65,6 @@ public void setValidForIdentification(Boolean b) {
validForIdentification = b;
}

/*
public String getImageId() {
return imageId;
}
public void setImageId(String id) {
imageId = id;
}
public int[] getBbox() {
return bbox;
}
public void setBbox(int[] b) {
bbox = b;
}
public double getTheta() {
return theta;
}
public void setTheta(double t) {
theta = t;
}
*/
public String getIndividualId() {
return individualId;
}
Expand Down Expand Up @@ -219,7 +172,7 @@ public static void cacheRead(String filepath)
taxonomyList.add(tlist.optString(i, null)); // we add nulls too (snh,flw) to maintain offset
}
}
// i guess??? we should zero out this cache when reading
// we should zero out this cache when reading
cache = new ConcurrentHashMap<String, AnnotationLite>();
Iterator it = jcache.keys();
while (it.hasNext()) {
Expand Down Expand Up @@ -253,7 +206,7 @@ public static void cacheRead(String filepath)
cache.size() + " objects in " + (System.currentTimeMillis() - t) + "ms");
}

// this reads the cache from disk *and* starts a thread for saving upon shutdown, oy
// this reads the cache from disk *and* starts a thread for saving upon shutdown
public static void startup(final ServletContext sContext, final String context) {
try {
cacheRead(CommonConfiguration.getDataDirectory(sContext,
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/ecocean/ApiAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public String checkRequest(Object obj, HttpServletRequest request, JSONObject js

// returns map of (negative) permissions for this user (based on role) for this object class
// note: no hash key for a property means all access, therefore a null value means user CANNOT write
// TODO this structure is subject to change for sure!
// TODO: this structure is subject to change for sure!
public HashMap<String, String> permissions(Object o, HttpServletRequest request) {
return permissions(o.getClass().getName(), request);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public HashMap<String, String> permissions(String cname, HttpServletRequest requ
Element pel = (Element)props.item(j);
String propName = pel.getAttribute("name");
if (propName != null) {
///////////// TODO for now we assume we ONLY have a sub element for <write> perm here so we skip a step
// TODO: for now we assume we ONLY have a sub element for <write> perm here so we skip a step
NodeList proles = pel.getElementsByTagName("role");
boolean allowed = false;
for (int k = 0; k < proles.getLength(); k++) {
Expand Down
91 changes: 3 additions & 88 deletions src/main/java/org/ecocean/Cluster.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO: #825 evaluate and remove as deprecated

package org.ecocean;

import org.joda.time.DateTime;
Expand Down Expand Up @@ -79,7 +81,6 @@ public static List<Occurrence> fromSmartXml(File smartXmlFile, List<MediaAsset>
Node wnode = wlist.item(w);
if (wnode.getNodeType() != Node.ELEMENT_NODE) continue;
Element wel = (Element)wnode; // <waypoints id="4" x="37.4676312262241" y="0.278523922074831" time="11:00:40">
///////TODO verify that this produces correct output
String x = wel.getAttribute("x");
Double decimalLongitude = strToDoubleNoExceptions(x);
String y = wel.getAttribute("y");
Expand All @@ -105,47 +106,6 @@ public static List<Occurrence> fromSmartXml(File smartXmlFile, List<MediaAsset>
System.out.println(" - valid observation found at waypoint id=" +
wel.getAttribute("id"));

/* here is an example of stuff we have in an animal observation. not sure if this is exhaustive??
a whole bunch of these were implemented for lewa in "previous ibeis branch" on the occurrence, such as:
occ.setNumBachMales(int); see Occurrence.java for those... which will need to be ported... :/ TODO
<observations categoryKey="animals.liveanimals.">
<attributes attributeKey="species">
<itemKey>chordata_rl.mammalia_rl.perissodactyla_rl.equidae_rl.equus_rl.equusgrevyi_rl7950.</itemKey>
</attributes>
<attributes attributeKey="habitat">
<itemKey>openwoodland</itemKey>
</attributes>
<attributes attributeKey="groupsize">
<dValue>6.0</dValue>
</attributes>
<attributes attributeKey="noofbm">
<dValue>6.0</dValue>
</attributes>
<attributes attributeKey="nooftm">
<dValue>1.0</dValue>
</attributes>
<attributes attributeKey="distancem">
<dValue>51.0</dValue>
</attributes>
<attributes attributeKey="noofnlf">
<dValue>7.0</dValue>
</attributes>
<attributes attributeKey="nooflf">
<dValue>2.0</dValue>
</attributes>
<attributes attributeKey="numberof612monthsfemales">
<dValue>2.0</dValue>
</attributes>
<attributes attributeKey="bearing">
<dValue>30.0</dValue>
</attributes>
<attributes attributeKey="photonumber">
<sValue>1</sValue>
</attributes>
</observations>
*/
Occurrence occ = new Occurrence();
occ.setOccurrenceID(Util.generateUUID());
occ.setDecimalLatitude(decimalLatitude);
Expand All @@ -154,7 +114,6 @@ public static List<Occurrence> fromSmartXml(File smartXmlFile, List<MediaAsset>

Integer photoOffset = null;
NodeList alist = oel.getElementsByTagName("attributes");
// TODO this is where we would build out the Occurrence
if (alist.getLength() > 0) {
for (int a = 0; a < alist.getLength(); a++) {
Node anode = alist.item(a);
Expand All @@ -173,37 +132,7 @@ public static List<Occurrence> fromSmartXml(File smartXmlFile, List<MediaAsset>
" > assets.size() " + assets.size());
}
break;
/* legacy zebra stuff
case "habitat":
occ.setHabitat(getValueString(ael));
break;
case "bearing":
occ.setBearing(getValueDouble(ael));
break;
case "groupsize":
occ.setGroupSize(getValueDoubleAsInt(ael));
break;
case "noofbm":
occ.setNumBachMales(getValueDoubleAsInt(ael));
break;
case "nooftm":
occ.setNumTerMales(getValueDoubleAsInt(ael));
break;
case "distancem":
occ.setDistance(getValueDouble(ael));
break;
case "noofnlf":
occ.setNumNonLactFemales(getValueDoubleAsInt(ael));
break;
case "nooflf":
occ.setNumLactFemales(getValueDoubleAsInt(ael));
break;
case "numberof612monthsfemales":
//
break;
*/
}
// TODO ... do something with the value!
}
}
System.out.println(" - created Occurrence " + occ);
Expand Down Expand Up @@ -234,16 +163,6 @@ public static List<Occurrence> fromSmartXml(File smartXmlFile, List<MediaAsset>
}
// persist the occ!
}
/*
val.put("time", el.getAttribute("time"));
NodeList anlist = el.getElementsByTagName("attributes");
if (an.getNodeType() != Node.ELEMENT_NODE) continue;
Element ael = (Element) an;
String aval = "";
NodeList vl = ael.getElementsByTagName("dValue"); //numeric if (vl.getLength() < 1) vl =
ael.getElementsByTagName("itemKey"); //string if (vl.getLength() > 0) aval = vl.item(0).getTextContent();
System.out.println(ael.getAttribute("attributeKey") + " -> " + aval);
*/

return occs;
}
Expand Down Expand Up @@ -423,11 +342,7 @@ public static String runJonsScript(List<MediaAsset> assets, Shepherd myShepherd)
String output = runPythonCommand(command);
int[] occNums = parseJonsOutput(output);
List<List<MediaAsset> > occurrenceGroups = groupAssetsByJonsOutput(validAssets, occNums);
/*
for (List<MediaAsset> occGroup : occurrenceGroups) {
Occurrence occ = new Occurrence(occGroup);
myShepherd.storeNewOccurrence(occ);
}*/

for (int i = 0; i < occurrenceGroups.size(); i++) {
List<MediaAsset> occGroup = occurrenceGroups.get(i);
Occurrence occ = new Occurrence(occGroup, myShepherd);
Expand Down
10 changes: 1 addition & 9 deletions src/main/java/org/ecocean/CommonConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ public static String getServerURL(Shepherd myShepherd) {
return u.toASCIIString().replaceFirst(":80\\b", ""); // hide :80 cuz its tacky
}

// TODO maybe these should be private so as not to be overused
public static JSONObject getServerInfo(Shepherd myShepherd) {
return SystemValue.getJSONObject(myShepherd, "SERVER_INFO");
}
Expand Down Expand Up @@ -519,11 +518,6 @@ public static String getGoogleAnalyticsId(String context) {
context).getProperty("ga_id", context);
}

/*
public static String getGoogleSearchKey(String context) {
return getProperty("googleSearchKey",context);
}
*/
public static String getDefaultGoogleMapsCenter(String context) {
if (getProperty("googleMapsCenter", context) != null) {
return getProperty("googleMapsCenter", context);
Expand Down Expand Up @@ -647,7 +641,6 @@ private static boolean parseBoolean(String s, boolean def) {
* @return Fully-qualified class name of the plugin to use, or null.
*/
public static String getBatchUploadPlugin(String context) {
// initialize(context);
if (getProperty("batchUploadPlugin", context) != null) {
return getProperty("batchUploadPlugin", context).trim();
}
Expand Down Expand Up @@ -782,7 +775,7 @@ public static boolean showReleaseDate(String context) {

public static String appendEmailRemoveHashString(HttpServletRequest request,
String originalString, String emailAddress, String context) {
return null; // disabled via issue #397
return null;
}

public static Map<String, String> getIndexedValuesMap(String baseKey, String context) {
Expand Down Expand Up @@ -894,7 +887,6 @@ public static String getDataDirectoryName(String context) {
initialize(context);
String dataDirectoryName = "shepherd_data_dir";
// new context code here
// if(props.getProperty("dataDirectoryName")!=null){return props.getProperty("dataDirectoryName").trim();}
if ((ContextConfiguration.getDataDirForContext(context) != null) &&
(!ContextConfiguration.getDataDirForContext(context).trim().equals(""))) {
dataDirectoryName = ContextConfiguration.getDataDirForContext(context);
Expand Down
Loading

0 comments on commit 3cde16b

Please sign in to comment.