}
/**
- * @param taxonomyRefName The proper refName for this authority
- * @param taxonInfo the properties for the new Taxonomy. Can pass in one condition
- * note and date string.
+ * @param taxonomyAuthRefName The proper refName for this authority.
+ * @param taxonInfo the properties for the new instance of a term in this authority.
* @param headerLabel The common part label
* @return The PoxPayloadOut payload for the create call
*/
value = taxonInfo.get(TaxonJAXBSchema.DISPLAY_NAME_COMPUTED);
boolean displayNameComputed = (value == null) || value.equalsIgnoreCase("true");
taxon.setDisplayNameComputed(displayNameComputed);
+ if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TERM_STATUS)) != null) {
+ taxon.setTermStatus(value);
+ }
+
+ // Fields specific to this authority record type.
if ((value = (String) taxonInfo.get(TaxonJAXBSchema.NAME)) != null) {
taxon.setTaxonFullName(value);
}
- if ((value = (String) taxonInfo.get(TaxonJAXBSchema.RANK)) != null) {
+ if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_RANK)) != null) {
taxon.setTaxonRank(value);
}
- if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TERM_STATUS)) != null) {
- taxon.setTermStatus(value);
+ if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_CURRENCY)) != null) {
+ taxon.setTaxonCurrency(value);
+ }
+ if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXON_YEAR)) != null) {
+ taxon.setTaxonYear(value);
}
- // FIXME: Add additional fields in the Taxon record here.
+ if ((value = (String) taxonInfo.get(TaxonJAXBSchema.TAXONOMIC_STATUS)) != null) {
+ taxon.setTaxonomicStatus(value);
+ }
+
+ // FIXME: Add additional fields in the Taxon record here,
+ // including at least one each of:
+ // * a repeatable field
+ // * a repeatable group of fields
+ // * a Boolean field
+ // * an authref field (when implemented)
PoxPayloadOut multipart = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
PayloadOutputPart commonPart = multipart.addPart(taxon,
public String getItemServicePathComponent() {
return AuthorityClient.ITEMS;
}
- final String TEST_NAME = "Centaurus pleurexanthemus Green 1832-";
final String TEST_SHORTID = "CentauruspleurexanthemusGreen1832";
- // TODO Make rank be a controlled vocab term, assuming that's how we'll implement it.
- final String TEST_RANK = "5";
- // TODO Make status type be a controlled vocab term.
- final String TEST_STATUS = "Approved";
+ final String TEST_TERM_STATUS = "accepted";
+ final String TEST_TAXON_FULL_NAME = "Centaurus pleurexanthemus Green 1832";
+ // TODO Re-implement the Taxon Rank field so as to provide an orderable
+ // ranking value, as well as a display name.
+ final String TEST_TAXON_RANK = "species";
+ final String TEST_TAXON_CURRENCY = "current";
+ final String TEST_TAXON_YEAR = "1832";
+ final String TEST_TAXONOMIC_STATUS = "valid";
+ final boolean TEST_TAXON_IS_NAMED_HYBRID = false;
/** The known resource id. */
private String knownResourceId = null;
private String knownResourceShortIdentifer = null;
private String knownTaxonomyTypeRefName = null;
private String knownItemResourceId = null;
private String knownItemResourceShortIdentifer = null;
- private String knownContactResourceId = null;
/** The n items to create in list. */
private int nItemsToCreateInList = 3;
/** The all resource ids created. */
// Submit the request to the service and store the response.
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
Map<String, String> taxonMap = new HashMap<String, String>();
- // TODO Make loc type and status be controlled vocabs.
+
+ // Fields present in all authority records.
taxonMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
- taxonMap.put(TaxonJAXBSchema.NAME, TEST_NAME);
- taxonMap.put(TaxonJAXBSchema.RANK, TEST_RANK);
- taxonMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_STATUS);
- // FIXME: Add additional fields in the Taxon record here.
+ // TODO Make term status be controlled vocab.
+ taxonMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
+
+ // Fields specific to this specific authority record type.
+ taxonMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
+ taxonMap.put(TaxonJAXBSchema.TAXON_RANK, TEST_TAXON_RANK);
+ taxonMap.put(TaxonJAXBSchema.TAXON_CURRENCY, TEST_TAXON_CURRENCY);
+ taxonMap.put(TaxonJAXBSchema.TAXON_YEAR, TEST_TAXON_YEAR);
+ taxonMap.put(TaxonJAXBSchema.TAXONOMIC_STATUS, TEST_TAXONOMIC_STATUS);
+
+ // FIXME: Add additional fields in the Taxon record here,
+ // including at least one each of:
+ // * a repeatable field
+ // * a repeatable group of fields
+ // * a Boolean field
+ // * an authref field (when implemented)
String newID = TaxonomyAuthorityClientUtils.createItemInAuthority(vcsid,
authRefName, taxonMap, client);
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- // Check whether we've received a taxon.
+ // Check whether we've received an authority item record.
PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
TaxonCommon taxon = (TaxonCommon) extractPart(input,
client.getItemCommonPartName(), TaxonCommon.class);
logger.debug(testName + ": returned payload:");
logger.debug(objectAsXmlString(taxon, TaxonCommon.class));
}
- Assert.assertEquals(taxon.getInAuthority(), knownResourceId);
+
+ // Check that this authority item record has the correct identifier
+ // pointing to its parent authority record.
+ Assert.assertNotNull(taxon.getInAuthority(), "inAuthority field value is unexpectedly null.");
+ Assert.assertEquals(taxon.getInAuthority(), knownResourceId,
+ "Value of item's inAuthority field does not contain the correct identifier "
+ + "pointing to its parent authority record.");
+
+ // Check individual fields in the authority item record.
+ Assert.assertNotNull(taxon.getTaxonFullName(), "Field value is unexpectedly null.");
+ Assert.assertEquals(taxon.getTaxonFullName(), TEST_TAXON_FULL_NAME,
+ "Field value " + taxon.getTaxonFullName()
+ + "does not match expected value " + TEST_TAXON_FULL_NAME);
} finally {
res.releaseConnection();
}
String displayName = taxon.getDisplayName();
// Make sure displayName matches computed form
String expectedDisplayName =
- TaxonomyAuthorityClientUtils.prepareDefaultDisplayName(TEST_NAME);
+ TaxonomyAuthorityClientUtils.prepareDefaultDisplayName(TEST_TAXON_FULL_NAME);
Assert.assertNotNull(displayName, expectedDisplayName);
// Update the shortName and verify the computed name is updated.
taxon.setCsid(null);
taxon.setDisplayNameComputed(true);
- taxon.setTaxonFullName("updated-" + TEST_NAME);
+ taxon.setTaxonFullName("updated-" + TEST_TAXON_FULL_NAME);
expectedDisplayName =
- TaxonomyAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_NAME);
+ TaxonomyAuthorityClientUtils.prepareDefaultDisplayName("updated-" + TEST_TAXON_FULL_NAME);
// Submit the updated resource to the service and store the response.
PoxPayloadOut output = new PoxPayloadOut(TaxonomyAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
// Verify that the updated resource received the correct data.
Assert.assertEquals(updatedTaxon.getTaxonFullName(), taxon.getTaxonFullName(),
- "Data in updated Taxonomy did not match submitted data.");
+ "Data in updated Taxon did not match submitted data.");
} finally {
res.releaseConnection();
}
// The only relevant ID may be the one used in update(), below.
TaxonomyAuthorityClient client = new TaxonomyAuthorityClient();
Map<String, String> nonexMap = new HashMap<String, String>();
- nonexMap.put(TaxonJAXBSchema.NAME, TEST_NAME);
+ nonexMap.put(TaxonJAXBSchema.NAME, TEST_TAXON_FULL_NAME);
nonexMap.put(TaxonJAXBSchema.SHORT_IDENTIFIER, "nonEx");
- nonexMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_STATUS);
+ nonexMap.put(TaxonJAXBSchema.TERM_STATUS, TEST_TERM_STATUS);
PoxPayloadOut multipart =
TaxonomyAuthorityClientUtils.createTaxonInstance(
TaxonomyAuthorityClientUtils.createTaxonomyRefName(knownResourceRefName, "nonEx", "Non Existent"),