Skip to content

Commit

Permalink
SAK-32489: Manually creating citations causes duplicate sections (sak…
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaswilson100 authored and jonespm committed May 1, 2017
1 parent 7f56fd1 commit b49774d
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ else if(value instanceof String)
*/
protected void commitCitationCollectionOrder(CitationCollectionOrder citationCollectionOrder)
{
deleteCitationCollectionOrder(citationCollectionOrder);

String orderStatement = "insert into " + m_collectionOrderTableName + " (COLLECTION_ID, CITATION_ID, LOCATION, SECTION_TYPE, VALUE) VALUES(?,?,?,?,?)";

Object[] orderFields = new Object[5];
Expand Down Expand Up @@ -1110,6 +1112,23 @@ protected void insertSchemaField(Field field, String schemaId)
}
}

/* (non-Javadoc)
* @see org.sakaiproject.citation.impl.BaseCitationService.Storage#deleteCitationCollectionOrder(rg.sakaiproject.citation.api.CitationCollectionOrder))
*/
protected void deleteCitationCollectionOrder(CitationCollectionOrder citationCollectionOrder)
{
String statement = "delete from " + m_collectionOrderTableName + " where (" + m_collectionTableId + " = ? AND " +
"LOCATION = ? AND SECTION_TYPE = ? AND VALUE = ? )";

Object fields[] = new Object[4];
fields[0] = citationCollectionOrder.getCollectionId();
fields[1] = citationCollectionOrder.getLocation();
fields[2] = citationCollectionOrder.getSectiontype();
fields[3] = citationCollectionOrder.getValue();

boolean ok = m_sqlService.dbWrite(statement, fields);
}

/* (non-Javadoc)
* @see org.sakaiproject.citation.impl.BaseCitationService.Storage#putSchemas(java.util.Collection)
*/
Expand Down

0 comments on commit b49774d

Please sign in to comment.