Skip to content

Commit

Permalink
Merge pull request #791 from WildMeOrg/283_adoption_removal
Browse files Browse the repository at this point in the history
Adoption removal
  • Loading branch information
TanyaStere42 authored Sep 27, 2024
2 parents dba0e6f + 5ecd186 commit 482958d
Show file tree
Hide file tree
Showing 92 changed files with 36 additions and 5,610 deletions.
171 changes: 0 additions & 171 deletions src/main/java/org/ecocean/Adoption.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/org/ecocean/CommonConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,6 @@ public static String getNumIaResultsUserCanInspect(String context) {
}
}

public static String getAdoptionCampaignUrl(String context) {
try {
return getProperty("adoptionCampaignUrl", context).trim();
} catch (NullPointerException e) {
System.out.println(
"NPE in getAdoptionCampaignUrl. Returning blank string as a default.");
return "";
}
}

public static String getAnimalSingular(String context) {
try {
return getProperty("animalSingular", context).trim();
Expand Down Expand Up @@ -587,22 +577,6 @@ public static boolean showProperty(String thisString, String context) {
return true;
}

/**
* This configuration option defines whether adoptions of MarkedIndividual or encounter objects are allowed. Generally adoptions are used as a
* fundraising or public awareness tool.
*
* @return true if adoption functionality should be displayed. False if adoptions are not supported in this catalog.
*/
public static boolean allowAdoptions(String context) {
initialize(context);
boolean canAdopt = true;
if ((getProperty("allowAdoptions", context) != null) && (getProperty("allowAdoptions",
context).equals("false"))) {
canAdopt = false;
}
return canAdopt;
}

public static Double getCenterLat(String context) {
double returnVal = 10.8;

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/ecocean/IndividualQueryProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,6 @@ public static MarkedIndividualQueryResult processQuery(Shepherd myShepherd,
allSharks = myShepherd.getAllMarkedIndividuals(query,
"dateTimeLatestSighting descending", paramMap);
}
// Added to show adoptable sharks in gallery.
else if (request.getParameter("sort").equals("dateTimeLatestSighting")) {
allSharks = myShepherd.getAllMarkedIndividuals(query,
"dateTimeLatestSighting descending", paramMap);
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/ecocean/MarkedIndividual.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class MarkedIndividual extends Base implements java.io.Serializable {
private String seriesCode = "None";

// the default is what was previously returned by .getNickName(), not the actual val
// these values are left for "historical record" even though adoptions are being sunset in issue 283
public final String DEFAULT_NICKNAME = "Unassigned";
private String nickName = "", nickNamer = "";

Expand Down Expand Up @@ -893,6 +894,7 @@ public void setNickName(String newName) {
this.addNameByKey(NAMES_KEY_NICKNAME, newName);
}

// setter removed by issue 283 (adoption retirement)
public String getNickNamer() {
if (nickNamer != null) {
return nickNamer;
Expand All @@ -901,10 +903,6 @@ public String getNickNamer() {
}
}

public void setNickNamer(String newNamer) {
nickNamer = newNamer;
}

public void setName(String newName) {
this.addName(newName);
}
Expand Down
97 changes: 0 additions & 97 deletions src/main/java/org/ecocean/NotificationMailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -542,31 +542,6 @@ public void replaceRegexInHtmlText(String search, String replace) {
}
}

/**
* Creates a basic tag map for the specified adoption. This map can subsequently be enhanced with extra tags. Adoption tags included:
* <ul>
* <li>&#64;INDIVIDUAL_LINK&#64;</li>
* <li>&#64;INDIVIDUAL_ID&#64;</li>
* <li>&#64;INDIVIDUAL_ALT_ID&#64;</li>
* <li>&#64;INDIVIDUAL_SEX&#64;</li>
* <li>&#64;INDIVIDUAL_NAME&#64;</li>
* <li>&#64;INDIVIDUAL_NICKNAME&#64;</li>
* <li>&#64;INDIVIDUAL_NICKNAMER&#64;</li>
* <li>&#64;INDIVIDUAL_COMMENTS&#64;</li>
* </ul>
*
* @param req servlet request for data reference
* @param ind MarkedIndividual for which to add tag data
* @return map instance for tag replacement in email template
*/
public static Map<String, String> createBasicTagMap(HttpServletRequest req, Adoption adp,
String scheme) {
Map<String, String> map = new HashMap<>();

addTags(map, req, adp, scheme);
return map;
}

/**
* Creates a basic tag map for the specified encounter. This map can subsequently be enhanced with extra tags. Individual tags included:
* <ul>
Expand Down Expand Up @@ -652,39 +627,6 @@ public static Map<String, String> createBasicTagMap(HttpServletRequest req,
return createBasicTagMap(req, ind, enc, req.getScheme());
}

public static Map<String, String> createBasicTagMap(HttpServletRequest req,
MarkedIndividual ind, Adoption adp, String scheme) {
Map<String, String> map = new HashMap<>();

addTags(map, req, ind, scheme);
addTags(map, req, adp, scheme);
return map;
}

public static Map<String, String> createBasicTagMap(HttpServletRequest req,
MarkedIndividual ind, Adoption adp) {
return createBasicTagMap(req, ind, adp, req.getScheme());
}

public static Map<String, String> createBasicTagMap(HttpServletRequest req, Encounter enc,
Adoption adp, String scheme) {
Map<String, String> map = new HashMap<>();

addTags(map, req, enc, scheme);
addTags(map, req, adp, scheme);
return map;
}

public static Map<String, String> createBasicTagMap(HttpServletRequest req, Encounter enc,
Adoption adp, MarkedIndividual ind, String scheme) {
Map<String, String> map = new HashMap<>();

addTags(map, req, enc, scheme);
addTags(map, req, adp, scheme);
addTags(map, req, ind, scheme);
return map;
}

/**
* Adds info tags for the specified encounter.
*
Expand Down Expand Up @@ -713,45 +655,6 @@ private static void addTags(Map<String, String> map, HttpServletRequest req,
}
}

/**
* Adds info tags for the specified adoption.
*
* @param req servlet request for data reference
* @param ind Adoption for which to add tag data
* @param map map to which to add tag data
*/
private static void addTags(Map<String, String> map, HttpServletRequest req, Adoption adp,
String scheme) {
Objects.requireNonNull(map);
if (!map.containsKey("@URL_LOCATION@"))
map.put("@URL_LOCATION@",
String.format(scheme + "://%s", CommonConfiguration.getURLLocation(req)));
if (adp != null) {
map.put("@ADOPTION_CANCELLATION_LINK@",
String.format(
"%s/adoptions/emailCancelAdoption.jsp?number=%s&stripeID=%s&adoption=%s",
map.get("@URL_LOCATION@"), adp.getMarkedIndividual(), adp.getStripeCustomerId(),
adp.getID()));
map.put("@ADOPTION_ALTERATION_LINK@",
String.format(
"%s/adoptions/emailAlterAdoption.jsp?number=%s&stripeID=%s&adoption=%s",
map.get("@URL_LOCATION@"), adp.getMarkedIndividual(), adp.getStripeCustomerId(),
adp.getID()));
map.put("@ADOPTION_ID@", adp.getID());
map.put("@ADOPTION_STRIPE_CUSTOMER_ID@", adp.getStripeCustomerId());
map.put("@ADOPTER_NAME@", adp.getAdopterName());
map.put("@ADOPTER_EMAIL@", adp.getAdopterEmail());
map.put("@ADOPTER_ADDRESS@", adp.getAdopterAddress());
map.put("@ADOPTER_QUOTE@", adp.getAdopterQuote());
map.put("@ADOPTION_MANAGER@", adp.getAdoptionManager());
map.put("@ADOPTION_INDIVIDUAL@", adp.getMarkedIndividual());
map.put("@ADOPTION_ENCOUNTER@", adp.getEncounter());
map.put("@ADOPTION_NOTES@", adp.getNotes());
map.put("@ADOPTION_TYPE@", adp.getAdoptionType());
map.put("@ADOPTION_START@", adp.getAdoptionStartDate());
}
}

/**
* Creates a basic tag map for the specified encounter. This map can subsequently be enhanced with extra tags.
*
Expand Down
Loading

0 comments on commit 482958d

Please sign in to comment.