Skip to content

Commit

Permalink
removed long-commented out code, unneeded todos, updated with known T…
Browse files Browse the repository at this point in the history
…ODO:
  • Loading branch information
TanyaStere42 committed Oct 9, 2024
1 parent c93ab1c commit d58e55f
Show file tree
Hide file tree
Showing 114 changed files with 282 additions and 2,973 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/ecocean/Annotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ public Annotation() {}
protected String acmId;

// this is used to decide "should we match against this" problem is: that is not very (IA-)algorithm agnostic
// TODO was this made obsolete by ACM and friends?
// TODO: was this made obsolete by ACM and friends?
private boolean matchAgainst = false;

// TODO can these (thru mediaAsset) be removed now that there Features?
// TODO: can these (thru mediaAsset) be removed now that there Features?
private int x;
private int y;
private int width;
Expand Down Expand Up @@ -369,7 +369,7 @@ JSONObject iaViewpointFromAnnotUUID(String uuid, String context) throws RuntimeE
NoSuchAlgorithmException, InvalidKeyException {
*/

// TODO Deprecate "all of this" now that deployed sites are migrated
// TODO: Deprecate "all of this" now that deployed sites are migrated
public MediaAsset __getMediaAsset() {
return mediaAsset;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ private String getMatchingSetFilterFromParameters(JSONObject taskParams) {
if (opt.equals("me"))
f += " && user.uuid == '" + userId +
"' && (enc.submitters.contains(user) || enc.submitterID == user.username) ";
// TODO also handle user "collab"
// TODO: also handle user "collab"
}
}
// add projectID to filter
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
74 changes: 2 additions & 72 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 @@ -104,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 @@ -153,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 @@ -172,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
12 changes: 6 additions & 6 deletions src/main/java/org/ecocean/Encounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1752,7 +1752,7 @@ public void setSurveyID(String id) {
public void setSurvey() {
}

// TODO Get all this lat lon over to Locations
// TODO: Get all this lat lon over to Locations

public void setDWCDecimalLatitude(double lat) {
if (lat == -9999.0) {
Expand Down Expand Up @@ -2156,7 +2156,7 @@ public String getTaxonomyString() {
}

// hacky (as generates new Taxonomy -- with random uuid) but still should work for tax1.equals(tax2);
// TODO FIXME this should be superceded by the getter for Taxonomy property in the future....
// TODO: FIXME this should be superceded by the getter for Taxonomy property in the future....
public Taxonomy getTaxonomy(Shepherd myShepherd) {
String sciname = this.getTaxonomyString();

Expand Down Expand Up @@ -2624,7 +2624,7 @@ public Set<String> getAnnotationIAClasses() {
for (Annotation ann : annotations) {
if (ann.getIAClass() != null) classes.add(ann.getIAClass());
}
// TODO we should find out how/where bunk iaClass values are getting set
// TODO: we should find out how/where bunk iaClass values are getting set
// and stop the via isValidIAClass() or similar
// also should be considered for any data integrity/repair tools
classes.remove("____");
Expand Down Expand Up @@ -3302,7 +3302,7 @@ public boolean restAccess(HttpServletRequest request, org.json.JSONObject jsonob
return true;
}

///////// these are bunk now - dont use Features TODO fix these - perhaps by crawlng thru ma.getAnnotations() ?
///////// these are bunk now - dont use Features TODO: fix these - perhaps by crawlng thru ma.getAnnotations() ?
public static Encounter findByMediaAsset(MediaAsset ma, Shepherd myShepherd) {
String queryString =
"SELECT FROM org.ecocean.Encounter WHERE annotations.contains(ann) && ann.mediaAsset.id =="
Expand Down Expand Up @@ -3487,7 +3487,7 @@ public ImportTask getImportTask(Shepherd myShepherd) {
}

// this is a special state only used now for match.jsp but basically means the data should be mostly hidden and soon deleted, roughly speaking???
// TODO figure out what this really means
// TODO: figure out what this really means
public void setMatchingOnly() {
this.setState(STATE_MATCHING_ONLY);
}
Expand All @@ -3501,7 +3501,7 @@ public void detectedAnnotation(Shepherd myShepherd, Annotation ann) {
/*
note: these are baby steps into proper ownership of Encounters. a similar (but cleaner) attempt is done in MediaAssets... however, really this
probably should be upon some (mythical) BASE CLASS!!!! ... for now, this Encounter variation kinda fudges with existing "ownership" stuff,
namely, the submitterID - which maps (in theory!) to a User username. TODO much much much ... incl call via constructor maybe ?? etc.
namely, the submitterID - which maps (in theory!) to a User username. TODO: much much much ... incl call via constructor maybe ?? etc.
*/
// NOTE: not going to currently persist the AccessControl object yet, but create on the fly... clever? stupid?
public AccessControl getAccessControl() {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/ecocean/MarkedIndividual.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class MarkedIndividual extends Base implements java.io.Serializable {
// first sighting
private String dateFirstIdentified;

// points to thumbnail (usually of most recent encounter) - TODO evaluate and remove if has been superceded by MediaAsset
// points to thumbnail (usually of most recent encounter) - TODO: evaluate and remove if has been superceded by MediaAsset
private String thumbnailUrl;

// a Vector of Strings of email addresses to notify when this MarkedIndividual is modified
Expand Down Expand Up @@ -637,7 +637,7 @@ public boolean wasSightedInYearLeftTagsOnly(int year, String locCode) {
return false;
}

// TODO evaluate and remove if deprecated
// TODO: evaluate and remove if deprecated
public double averageLengthInYear(int year) {
int numLengths = 0;
double total = 0;
Expand All @@ -657,7 +657,7 @@ public double averageLengthInYear(int year) {
return avg;
}

// TODO evaluate and remove if deprecated
// TODO: evaluate and remove if deprecated
public double averageMeasuredLengthInYear(int year, boolean allowGuideGuess) {
int numLengths = 0;
double total = 0;
Expand Down Expand Up @@ -804,7 +804,7 @@ public String getName(Object keyHint) {
return names.getValue(keyHint);
}

// TODO evaluate and remove if deprecated: ##DEPRECATED #509 - Base class getId() method
// TODO: evaluate and remove if deprecated: ##DEPRECATED #509 - Base class getId() method
public String getIndividualID() {
return individualID;
}
Expand Down Expand Up @@ -841,7 +841,7 @@ public String getLegacyIndividualID() {
return legacyIndividualID;
}

// TODO evaluate and remove if deprecated: ##DEPRECATED #509 - Base class getId() method
// TODO: evaluate and remove if deprecated: ##DEPRECATED #509 - Base class getId() method
public void setIndividualID(String id) {
individualID = id;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/ecocean/Occurrence.java
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ public boolean canUserAccess(HttpServletRequest request) {
List<String> ids = new ArrayList<String>();

for (User user : myShepherd.getAllUsers()) {
/* TODO we do not have user-flavored Collaboration.canUserAccessOccurrence yet
/* TODO: we do not have user-flavored Collaboration.canUserAccessOccurrence yet
if ((user.getId() != null) && this.canUserAccess(user, myShepherd.getContext())) ids.add(user.getId());
*/
if (user.getId() != null) ids.add(user.getId());
Expand All @@ -831,7 +831,7 @@ public boolean canUserAccess(HttpServletRequest request) {
List<String> ids = new ArrayList<String>();

for (User user : myShepherd.getAllUsers()) {
/* TODO we do not have edit stuff for occurrence
/* TODO: we do not have edit stuff for occurrence
if ((user.getId() != null) && this.canUserEdit(user)) ids.add(user.getId());
*/
if (user.getId() != null) ids.add(user.getId());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/OpenSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public static JSONObject querySanitize(JSONObject query, User user) {
return newQuery;
}

// TODO right now this respects index timestamp and only indexes objects with versions > timestamp.
// TODO: right now this respects index timestamp and only indexes objects with versions > timestamp.
// want to make an option to index everything and ignore version/timestamp.
public void indexAll(Shepherd myShepherd, Base obj)
throws IOException {
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/ecocean/PatterningPassport.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ private Boolean makeNewPassportXml(String context) {
CommonConfiguration.getDataDirectoryName(context));

// Universal passport fields for the XML
String encounterUrlString = "foo/" + this.encounterId; // TODO -- generate URL
String mediaSourceUrlString = "foo/" + this.mediaId; // TODO -- generate URL
String passportXmlUrlString = "foo"; // TODO -- generate URL
String encounterUrlString = "foo/" + this.encounterId; // TODO: -- generate URL
String mediaSourceUrlString = "foo/" + this.mediaId; // TODO: -- generate URL
String passportXmlUrlString = "foo"; // TODO: -- generate URL
String encounterDir = this.webappsDir + "/shepherd_data_dir/encounters/" +
this.encounterId;
String xmlFilePathString = encounterDir + "/" + mediaId + "_pp.xml";
Expand Down Expand Up @@ -182,7 +182,7 @@ public Boolean setPassportDataXml(String passportDataXml, String context) {
* @return the encounterUrl
*/
public String getEncounterUrl() {
// TODO read it from XML if needed
// TODO: read it from XML if needed
return encounterUrl;
}

Expand All @@ -198,7 +198,7 @@ public void setEncounterUrl(String encounterUrl) {
* @return the mediaUrl
*/
public String getMediaUrl() {
// TODO read it from XML if needed
// TODO: read it from XML if needed
return mediaUrl;
}

Expand All @@ -214,7 +214,7 @@ public void setMediaUrl(String mediaUrl) {
* @return the patterningPassportXmlUrl
*/
public String getPatterningPassportXmlUrl() {
// TODO read it from XML if needed
// TODO: read it from XML if needed
return patterningPassportXmlUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public static void writeToFile(URL url, File file)
}

/***********************************************************************************************
TODO evaluate strategy, rewrite as needed and define future actions that need to be taken to truly update
TODO: evaluate strategy, rewrite as needed and define future actions that need to be taken to truly update
some attempts to *truly* genericize these....
rather than authUsername/authPassword, we might want to have our own credential class that allows us to set headers etc accordingly!
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/Shepherd.java
Original file line number Diff line number Diff line change
Expand Up @@ -3838,7 +3838,7 @@ public boolean isDBTransactionActive() {
/**
* Commits (makes permanent) any changes made to an open database
*/
// TODO Either (a) throw an exception itself or (b) return boolean of success (the latter was disabled, needs investigation)
// TODO: Either (a) throw an exception itself or (b) return boolean of success (the latter was disabled, needs investigation)
public void commitDBTransaction() {
try {
// System.out.println(" shepherd:"+identifyMe+" is trying to commit a transaction");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public void unsetSocial(String type) {
social.remove(type);
}

// TODO this needs to be dealt with better. see: rant about saving usernames from forms
// TODO: this needs to be dealt with better. see: rant about saving usernames from forms
public static boolean isUsernameAnonymous(String uname) {
return ((uname == null) || uname.trim().equals("") || uname.equals("N/A") ||
uname.equals("public"));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/api/SiteSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
settings.put("measurement",
CommonConfiguration.getIndexedPropertyValues("measurement", context));

// TODO: there was some discussion in slack about this being derived differently
// TODO: evaluate deriving this differently
// NOTE: historically this list was generated via CommonConfiguration using
// List<String> states = CommonConfiguration.getIndexedPropertyValues("encounterState",context)
settings.put("encounterState", VALUES_ENCOUNTER_STATES);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/ecocean/cache/CachedQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public JSONObject convertToJson(Collection coll, ExecutionContext ec) {
for (Object o : coll) {
if (o instanceof Collection) {
jarr.put(convertToJson((Collection)o, ec));
} else { // TODO can it *only* be an JSONObject-worthy object at this point?
} else {
try {
jarr.put(Util.toggleJSONObject(RESTUtils.getJSONObjectFromPOJO(o, ec)));
} catch (Exception e) {
Expand Down
Loading

0 comments on commit d58e55f

Please sign in to comment.