Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Add contentPlaces, materialTechniqueDescription to ES mappings
* Add blob alt text to media responses
* Remove cspace_english namespace search
* Media Handling: Remove any query parameters from file name created, after uploading external media files

### Bug Fixes

Expand Down
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ host=127.0.0.1
#
# Release version info
#
release.version=8.3.0-RC.2
release.version=8.3.0-RC.3
cspace.release=${release.version}
cspace.instance.id=${env.CSPACE_INSTANCE_ID}

Expand All @@ -27,7 +27,7 @@ cspace.im.root=
# UI settings
cspace.ui.package.name=cspace-ui
cspace.ui.library.name=cspaceUI
cspace.ui.version=10.2.0-rc2.0
cspace.ui.version=10.2.0-rc3.0
cspace.ui.build.branch=develop
cspace.ui.build.node.ver=20
service.ui.library.name=${cspace.ui.library.name}-service
Expand Down
2 changes: 1 addition & 1 deletion cspace-ui/materials/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname}

tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-materials
tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileMaterials
tenant.ui.profile.plugin.version=4.1.0
tenant.ui.profile.plugin.version=4.1.1
tenant.ui.profile.plugin.build.branch=main

# If not set, defaults to /gateway/${tenant.shortname} on the current host.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<name>services</name>

<properties>
<revision>8.3.0-RC.2</revision>
<revision>8.3.0-RC.3</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cspace.services.version>${revision}</cspace.services.version>
<cspace.services.client.version>${revision}</cspace.services.client.version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.collectionspace.services.advancedsearch.model;

import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
import org.collectionspace.services.collectionobject.MaterialGroupList;

public class MaterialModel {

public static String material(CollectionobjectsCommon collectionObject) {
String material = null;
if (collectionObject != null && collectionObject.getMaterialGroupList() != null) {
MaterialGroupList materialGroup = collectionObject.getMaterialGroupList();
if (!materialGroup.getMaterialGroup().isEmpty()) {
material = materialGroup.getMaterialGroup().get(0).getMaterial();
}
}
return material;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.CollectionobjectsNaturalhistory;
import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.DeterminationHistoryGroup;
import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.DeterminationHistoryGroupList;
import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.TaxonomicIdentGroup;
import org.collectionspace.services.collectionobject.domain.naturalhistory_extension.TaxonomicIdentGroupList;

Expand Down Expand Up @@ -34,4 +36,18 @@ public static String preservationForm(final CollectionobjectsCommon common) {

return form;
}

public static String determinationTaxon(final CollectionobjectsNaturalhistory naturalHistory) {
String taxon = null;
if (naturalHistory != null && naturalHistory.getTaxonomicIdentGroupList() != null) {
DeterminationHistoryGroupList determinationGroupList = naturalHistory.getDeterminationHistoryGroupList();
List<DeterminationHistoryGroup> determinationGroups = determinationGroupList.getDeterminationHistoryGroup();
if (!determinationGroups.isEmpty()) {
DeterminationHistoryGroup group = determinationGroups.get(0);
taxon = group.getDeterminationTaxon();
}
}

return taxon;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
<xs:element name="objectProductionDate" type="xs:string" nillable="true"/>
<xs:element name="objectProductionPlace" type="xs:string" nillable="true"/>

<!-- for materials profile -->
<xs:element name="material" type="xs:string" nillable="true"/>

<!-- for herbarium profile -->
<xs:element name="determinationTaxon" type="xs:string" nillable="true"/>

<xs:element name="contentConcepts" type="contentConcepts" nillable="true"/>
<xs:element name="nagpraCategories" type="nagpraCategories" nillable="true"/>
</xs:sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.collectionspace.services.advancedsearch.model.BriefDescriptionListModel;
import org.collectionspace.services.advancedsearch.model.ContentConceptListModel;
import org.collectionspace.services.advancedsearch.model.FieldCollectionModel;
import org.collectionspace.services.advancedsearch.model.MaterialModel;
import org.collectionspace.services.advancedsearch.model.NAGPRACategoryModel;
import org.collectionspace.services.advancedsearch.model.ObjectNameListModel;
import org.collectionspace.services.advancedsearch.model.ObjectProductionModel;
Expand Down Expand Up @@ -139,6 +140,7 @@ public AdvancedsearchListItem asListItem(final CSDocumentModelResponse response,
});

item.setForm(TaxonModel.preservationForm(collectionObject));
item.setMaterial(MaterialModel.material(collectionObject));

// from media resource
if (!blobInfo.isEmpty()) {
Expand All @@ -151,6 +153,7 @@ public AdvancedsearchListItem asListItem(final CSDocumentModelResponse response,

if (naturalHistory != null) {
item.setTaxon(TaxonModel.taxon(naturalHistory));
item.setDeterminationTaxon(TaxonModel.determinationTaxon(naturalHistory));
}

if (objectsNAGPRA != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<xs:element name="fieldHigherGeography" type="xs:string"/>

<xs:element name="taxonomicIdentGroupList" type="taxonomicIdentGroupList"/>
<xs:element name="determinationHistoryGroupList" type="determinationHistoryGroupList"/>
<xs:element name="typeSpecimenGroupList" type="typeSpecimenGroupList"/>
<xs:element name="fieldCollElevationGroupList" type="fieldCollElevationGroupList"/>
<xs:element name="fieldCollDepthGroupList" type="fieldCollDepthGroupList"/>
Expand Down Expand Up @@ -70,6 +71,26 @@
<xs:element name="notes" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="determinationHistoryGroupList">
<xs:sequence>
<xs:element name="determinationHistoryGroup" type="determinationHistoryGroup" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="determinationHistoryGroup">
<xs:sequence>
<xs:element name="determinationQualifier" type="xs:string"/>
<xs:element name="determinationRefPage" type="xs:string"/>
<xs:element name="determinationInstitution" type="xs:string"/>
<xs:element name="determinationTaxon" type="xs:string"/>
<xs:element name="determinationKind" type="xs:string"/>
<xs:element name="determinationReference" type="xs:string"/>
<xs:element name="determinationNote" type="xs:string"/>
<xs:element name="determinationBy" type="xs:string"/>
<!-- DateGroup is a structured date; omitting for now since this schema is out of date
<xs:element name="determinationDateGroup" type="xs:string"/>
-->
</xs:sequence>
</xs:complexType>

<xs:complexType name="typeSpecimenGroupList">
<xs:sequence>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static String getDestDir(String destDir) {
}
return null;
}

return destDir;
}

Expand All @@ -54,21 +54,21 @@ public static File downloadFile(String fileURL) throws IOException {
if (tmpdir.endsWith(File.separator) == false) {
tmpdir = tmpdir + File.separator;
}

String destDir = getDestDir(tmpdir + UUID.randomUUID() + File.separator);
String filePath = downloadFile(fileURL, destDir);
result = new File(filePath);
} catch (Exception e) {
String msg = String.format("Could not download file use this URL: %s", fileURL);
logger.error(msg, e);
}

return result;
}

/**
* Downloads a file from a URL
*
*
* @param fileURL HTTP URL of the file to be downloaded
* @param saveDir path of the directory to save the file
* @throws IOException
Expand All @@ -81,7 +81,7 @@ private static String downloadFile(String fileURL, String saveDir) throws IOExce

try {
httpResponseCode = httpConn.getResponseCode();

// always check HTTP response code first
if (httpResponseCode == HttpURLConnection.HTTP_OK) {
String fileName = "";
Expand All @@ -96,24 +96,29 @@ private static String downloadFile(String fileURL, String saveDir) throws IOExce
} else {
// extracts file name from URL
fileName = fileURL.substring(fileURL.lastIndexOf("/") + 1, fileURL.length());
// Remove query parameters from filename
int qIndex = fileName.indexOf("?");
if (qIndex > -1) {
fileName = fileName.substring(0, qIndex);
}
}

if (logger.isDebugEnabled()) {
String contentType = httpConn.getContentType();
int contentLength = httpConn.getContentLength();
logger.debug("File name is:" + fileName);
logger.debug("Disposition is:" + disposition != null ? disposition : "<empty>");
logger.debug("Content type is:" + contentType != null ? contentType : "<empty>");
logger.debug("Content length is:" + contentLength);
}
}

// opens input stream from the HTTP connection
InputStream inputStream = httpConn.getInputStream();
String saveFilePath = saveDir + File.separator + fileName; //FIXME: File.separator NOT needed

// opens an output stream to save into file
FileOutputStream outputStream = new FileOutputStream(saveFilePath);

try {
int bytesRead = -1;
byte[] buffer = new byte[BUFFER_SIZE];
Expand Down