Skip to content
This repository has been archived by the owner on Mar 26, 2019. It is now read-only.

Commit

Permalink
Merge pull request #272 from OCHA-DAP/bugfix-bundle-2014-08
Browse files Browse the repository at this point in the history
Pull request for: #256
  • Loading branch information
alexandru-m-g committed Sep 1, 2014
2 parents 59eef91 + e1c8654 commit bb239e9
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ public interface DataSerieMetadataDAO {

public DataSerieMetadata getDataSerieMetadataByIndicatorTypeCodeAndSourceCodeAndEntryKey(final String indicatorTypeCode, final String sourceCode, final MetadataName entryKey);

public void deleteDataSerieMetadataForIndicatorType(long indicatorTypeId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ public DataSerieMetadata getDataSerieMetadataByIndicatorTypeCodeAndSourceCodeAnd
}
}

@Override
@Transactional
public void deleteDataSerieMetadataForIndicatorType(final long indicatorTypeId) {
em.createQuery("DELETE FROM DataSerieMetadata ad WHERE ad.indicatorType.id=:indicatorTypeId").setParameter("indicatorTypeId", indicatorTypeId).executeUpdate();

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public void updateIndicatorType(final long indicatorTypeId, final String newCode
@Override
@Transactional
public void deleteIndicatorType(final long indicatorTypeId) {
dataSerieMetadataDAO.deleteDataSerieMetadataForIndicatorType(indicatorTypeId);
indicatorTypeDAO.deleteIndicatorType(indicatorTypeId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ public final void testDeleteDataSerieMetadata() {
textDAO.deleteText(text.getId());
}

@Test
public final void testDeleteDataSerieMetadataForIndicatorType() {

final Text text = textDAO.createText("Dummy Value");
final DataSerieMetadata dataSerieMetadata = dataSerieMetadataDAO.createDataSerieMetadata(indicatorType, source, MetadataName.METHODOLOGY, text);
assertTrue(dataSerieMetadata.getId() > 0);

dataSerieMetadataDAO.deleteDataSerieMetadataForIndicatorType(indicatorType.getId());

assertNull(dataSerieMetadataDAO.getDataSerieMetadataById(dataSerieMetadata.getId()));

}

/**
* Test method for {@link org.ocha.hdx.persistence.dao.metadata.DataSerieMetadataDAOImpl#updateDataSerieMetadata(long, org.ocha.hdx.persistence.entity.i18n.Text)}.
*/
Expand Down

0 comments on commit bb239e9

Please sign in to comment.