From 1c34e2b2a82df0d3ef572fa6936cf603818921ae Mon Sep 17 00:00:00 2001 From: jateeter Date: Sun, 2 Feb 2014 15:03:44 -0500 Subject: [PATCH] re-write of the "related" and "self" href generation movement of xxxxxService -> ResourceService in the export classes Update of the ExportFilter code style --- .../espi/common/models/atom/ContentType.java | 186 +++++++----------- .../espi/common/service/ResourceService.java | 10 +- .../service/impl/ExportServiceImpl.java | 40 ++-- .../service/impl/ResourceServiceImpl.java | 33 +++- 4 files changed, 127 insertions(+), 142 deletions(-) diff --git a/src/main/java/org/energyos/espi/common/models/atom/ContentType.java b/src/main/java/org/energyos/espi/common/models/atom/ContentType.java index 2de461fa..e7c68208 100644 --- a/src/main/java/org/energyos/espi/common/models/atom/ContentType.java +++ b/src/main/java/org/energyos/espi/common/models/atom/ContentType.java @@ -467,11 +467,10 @@ public void setResources(List identifiedObjects) { } public TimeConfiguration getTimeConfiguration() { - // TODO Auto-generated method stub - return null; + return localTimeParameters; } - public Long getContentId(Class resourceClass) { + public Long getContentId(Class resourceClass) { // TODO its ugly right now, clean it up when templates are done Long result = 1L; if (this.getApplicationInformation() != null) { @@ -534,114 +533,79 @@ public Long getContentId(Class resourceClass) { } public String buildSelfHref(String hrefFragment) { - // TODO its ugly right now (and getting uglier:( , clean it up when templates are done - // right now this is very specific to .../UsagePoint as seen in a download - String result = hrefFragment; - String usagePointId = ""; - Boolean usagePointId_P = false; - - // if the last element of the fragment is a UsagePoint, we will need to add a usagePointId to the URI - if (hrefFragment.lastIndexOf("UsagePoint") == (hrefFragment.length() - "UsagePoint".length())) - { - usagePointId_P = true; - } + // strip the result down to the "..../resource" + String result = hrefFragment.substring(0, hrefFragment.indexOf("/resource") + "/resource".length()); // now do the right thing for each resource (there will be only one non-null resource in the ContentType - + // if (this.getApplicationInformation() != null) { - result = result + this.getApplicationInformation().getId(); + result = result + "/ApplicationInformation/"+ this.getApplicationInformation().getId(); } if (this.getAuthorization() != null) { - result = result + this.getAuthorization().getId(); + result = result + "/Authorization/" + this.getAuthorization().getId(); } if (this.getElectricPowerQualitySummary() != null) { - if (usagePointId_P) { - - UsagePoint usagePoint = this.getElectricPowerQualitySummary().getUsagePoint(); - usagePointId = "/" + usagePoint.getId(); - } - result = result + usagePointId + "/ElectricPowerQualitySummary/" + this.getElectricPowerQualitySummary().getId(); + + UsagePoint usagePoint = this.getElectricPowerQualitySummary().getUsagePoint(); + RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); + result = result + "/RetailCustomer/" + retailCustomer.getId() + + "/UsagePoint/" + usagePoint.getId() + + "/ElectricPowerQualitySummary/" + this.getElectricPowerQualitySummary().getId(); } if (this.getElectricPowerUsageSummary() != null) { - if (usagePointId_P) { - - UsagePoint usagePoint = this.getElectricPowerUsageSummary().getUsagePoint(); - usagePointId = "/" + usagePoint.getId(); - } - - result = result + usagePointId + "/ElectricPowerUsageSummary/" + this.getElectricPowerUsageSummary().getId(); + UsagePoint usagePoint = this.getElectricPowerUsageSummary().getUsagePoint(); + RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); + result = result + "/RetailCustomer/" + retailCustomer.getId() + + "/UsagePoint/" + usagePoint.getId() + + "/ElectricPowerUsageSummary/" + this.getElectricPowerUsageSummary().getId(); } if (this.getIntervalBlocks() != null) { MeterReading meterReading = this.getIntervalBlocks().get(0) .getMeterReading(); - if (usagePointId_P) { - - UsagePoint usagePoint = meterReading.getUsagePoint(); - usagePointId = "/" + usagePoint.getId(); - } - - result = result + usagePointId + "/MeterReading/" + meterReading.getId() + "/IntervalBlock/" + this.getIntervalBlocks().get(0).getId(); + UsagePoint usagePoint = meterReading.getUsagePoint(); + RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); + result = result + "/RetailCustomer/" + retailCustomer.getId() + + "/UsagePoint/" + usagePoint.getId() + + "/MeterReading/" + meterReading.getId() + + "/IntervalBlock/" + this.getIntervalBlocks().get(0).getId(); } if (this.getLocalTimeParameters() != null) { - // here, we assume "result" has got the right mutated hrefFragment ... - String temp = result.substring(0, result.indexOf("/RetailCustomer")); - // temp now has only the .../espi/1_1/resource in it. - result = temp + "/LocalTimeParameters/" + this.getLocalTimeParameters().getId(); - /* - // if one had a normal structure, one would have ... - UsagePoint usagePoint = this.getLocalTimeParameters() - .getUsagePoint(); - RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); - result = result + "/" + usagePoint.getId() - + "/LocalTimeParameters/" - + this.getLocalTimeParameters().getId(); - */ + + result = result + "/LocalTimeParameters/" + this.getLocalTimeParameters().getId(); + } if (this.getMeterReading() != null) { - if (usagePointId_P) { - - UsagePoint usagePoint = meterReading.getUsagePoint(); - usagePointId = "/" + usagePoint.getId(); - } - result = result + usagePointId + "/MeterReading/" + this.getMeterReading().getId(); + UsagePoint usagePoint = this.getMeterReading().getUsagePoint(); + RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); + result = result + "/RetailCustomer/" + retailCustomer.getId() + + "/UsagePoint/" + usagePoint.getId() + + "/MeterReading/" + meterReading.getId(); } if (this.getReadingType() != null) { - // here, we assume "result" has got the right mutated hrefFragment ... - String temp = result.substring(0, result.indexOf("/RetailCustomer")); - // temp now has only the .../espi/1_1/resource in it. - result = temp + "/ReadingType/" + this.getReadingType().getId(); - /* - * // if one had a normal structure, one would have ... - - MeterReading meterReading = this.getReadingType() - .getMeterReading(); - UsagePoint usagePoint = meterReading.getUsagePoint(); - RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); - result = result + "/" + usagePoint.getId() + "/MeterReading/" - + meterReading.getId() + "/ReadingType/" - + this.getReadingType().getId(); - */ + result = result + "/ReadingType/" + this.getReadingType().getId(); } if (this.getRetailCustomer() != null) { - result = result + "/" + this.getRetailCustomer().getId(); + result = result + "/RetailCustomer/" + this.getRetailCustomer().getId(); } if (this.getSubscription() != null) { - result = result + this.getSubscription().getId(); + result = result + "/Subscription/" + this.getSubscription().getId(); } if (this.getUsagePoint() != null) { - result = result + "/" + this.getUsagePoint().getId(); - } + RetailCustomer retailCustomer = this.getUsagePoint().getRetailCustomer(); + result = result + "/RetailCustomer/" + retailCustomer.getId() + + "/UsagePoint/" + this.getUsagePoint().getId(); + } return result; @@ -652,77 +616,63 @@ public String buildSelfHref(String hrefFragment) { public List buildRelHref(String hrefFragment) { - // TODO its ugly right now, clean it up when templates are done - // if the last element of the fragment is a UsagePoint, then we may be doing a full dump - // and the fragement generation logic is a bit different + // only MeterReading and UsagePoint have "related" references List result = new ArrayList(); if (this.getMeterReading() != null) { + // get the objects UsagePoint usagePoint = this.getMeterReading().getUsagePoint(); RetailCustomer retailCustomer = usagePoint.getRetailCustomer(); ReadingType readingType = this.getMeterReading().getReadingType(); + String temp = hrefFragment; - String usagePointId = ""; - if (hrefFragment.lastIndexOf("UsagePoint") == (hrefFragment.length() - "UsagePoint".length())) { - usagePointId = "/" + usagePoint.getId(); + + // check for ROOT form + if (hrefFragment.contains("/RetailCustomer")) { + // XPath form + temp = temp.substring(0, temp.indexOf("/RetailCustomer")); + } else { + // it is a ROOT form + temp = temp.substring(0, temp.indexOf("/MeterReading")); } - temp = temp + usagePointId + "/MeterReading/" + this.getMeterReading().getId(); + // build the full path + temp = temp + "/RetailCustomer/" + retailCustomer.getId() + "/UsagePoint/" + usagePoint.getId() + "/MeterReading/" + meterReading.getId(); + result.add(temp + "/IntervalBlock"); - temp = temp.substring(0, temp.indexOf("/RetailCustomer")); - result.add(temp + "/ReadingType/" + readingType.getId()); + // for ReadingType, make it ROOT access + result.add(temp.substring(0, temp.indexOf("/RetailCustomer")) + "/ReadingType/" + readingType.getId()); } if (this.getUsagePoint() != null) { + // get the objects RetailCustomer retailCustomer = this.getUsagePoint().getRetailCustomer(); List qualityList = this.getUsagePoint().getElectricPowerQualitySummaries(); List usageList = this.getUsagePoint().getElectricPowerUsageSummaries(); TimeConfiguration timeConfiguration = this.getUsagePoint().getLocalTimeParameters(); String temp = hrefFragment; - String usagePointId = ""; - if (hrefFragment.lastIndexOf("UsagePoint") == (hrefFragment.length() - "UsagePoint".length())) { - usagePointId = "/" + this.getUsagePoint().getId(); + // check for ROOT form + if (hrefFragment.contains("/RetailCustomer")) { + // XPath form + temp = temp.substring(0, temp.indexOf("/RetailCustomer")); + } else { + // ROOT form + temp = temp.substring(0, temp.indexOf("/UsagePoint")); } - temp = temp + usagePointId; - + // build the full path + temp = temp + "/RetailCustomer/" + retailCustomer.getId() + "/UsagePoint/" + usagePoint.getId(); + result.add(temp + "/MeterReading"); if (!(qualityList.isEmpty())) result.add(temp + "/ElectricPowerQualitySummary"); if (!(usageList.isEmpty())) result.add(temp + "/ElectricPowerUsageSummary"); // for LocalTimeParameters - make it a ROOT access // - temp = temp.substring(0, temp.indexOf("/RetailCustomer")); - result.add(temp + "/LocalTimeParameters/" + timeConfiguration.getId()); + result.add(temp.substring(0, temp.indexOf("/RetailCustomer")) + "/LocalTimeParameters/" + timeConfiguration.getId()); } - /* - if (this.getReadingType() != null) { - return result; } - if (this.getRetailCustomer() != null) { - return result; } - if (this.getSubscription() != null) { - return result; - } - if (this.getApplicationInformation() != null) { - return result; - } - if (this.getAuthorization() != null) { - return result; - } - if (this.getElectricPowerQualitySummary() != null) { - return result; - } - if (this.getElectricPowerUsageSummary() != null) { - return result; - } - if (this.getIntervalBlocks() != null) { - return result; - } - if (this.getLocalTimeParameters() != null) { - return result; - } - */ + return result; } diff --git a/src/main/java/org/energyos/espi/common/service/ResourceService.java b/src/main/java/org/energyos/espi/common/service/ResourceService.java index cfb1978b..e58cfe72 100755 --- a/src/main/java/org/energyos/espi/common/service/ResourceService.java +++ b/src/main/java/org/energyos/espi/common/service/ResourceService.java @@ -1,7 +1,10 @@ package org.energyos.espi.common.service; +import org.energyos.espi.common.domain.ElectricPowerUsageSummary; import org.energyos.espi.common.domain.IdentifiedObject; import org.energyos.espi.common.domain.Linkable; +import org.energyos.espi.common.models.atom.EntryType; +import org.energyos.espi.common.utils.EntryTypeIterator; import java.util.List; import java.util.UUID; @@ -22,8 +25,7 @@ List findByAllParentsHref(String relatedHref, List findAllIds(Class clazz); - List findAllIdsByUsagePointId(Long id, - Class clazz); + List findAllIdsByUsagePointId(Long id, Class clazz); List findAllIdsByXPath(Class clazz); @@ -41,4 +43,8 @@ List findAllIdsByUsagePointId(Long id, Long findIdByXPath(Long id1, Long id2, Long id3, Long id4, Class clazz); + EntryTypeIterator findEntryTypeIterator(Class clazz); + + EntryType findEntryType(long id1, Class clazz); + } diff --git a/src/main/java/org/energyos/espi/common/service/impl/ExportServiceImpl.java b/src/main/java/org/energyos/espi/common/service/impl/ExportServiceImpl.java index d55dcde3..42052845 100644 --- a/src/main/java/org/energyos/espi/common/service/impl/ExportServiceImpl.java +++ b/src/main/java/org/energyos/espi/common/service/impl/ExportServiceImpl.java @@ -166,13 +166,13 @@ public void setMarshaller(Jaxb2Marshaller fragmentMarshaller) { @Override public void exportApplicationInformation(Long applicationInformationId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ApplicationInformation/" + applicationInformationId; - exportEntry(applicationInformationService.findEntryType(applicationInformationId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(applicationInformationId, ApplicationInformation.class), stream, exportFilter, hrefFragment); } @Override public void exportApplicationInformations(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ApplicationInformation"; - exportEntries(applicationInformationService.findEntryTypeIterator(), stream, exportFilter, ApplicationInformation.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(ApplicationInformation.class), stream, exportFilter, ApplicationInformation.class, hrefFragment); } // Authorization @@ -181,13 +181,13 @@ public void exportApplicationInformations(OutputStream stream, ExportFilter expo @Override public void exportAuthorization(Long authorizationId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/Authorization/" + authorizationId; - exportEntry(authorizationService.findEntryType(0L, authorizationId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(authorizationId, Authorization.class), stream, exportFilter, hrefFragment); } @Override public void exportAuthorizations(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/Authorization"; - exportEntries(authorizationService.findEntryTypeIterator(), stream, exportFilter, Authorization.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(Authorization.class), stream, exportFilter, Authorization.class, hrefFragment); } // - XPath form @@ -209,13 +209,13 @@ public void exportAuthorizations(Long retailCustomerId, OutputStream stream, Exp @Override public void exportElectricPowerQualitySummary(Long electricPowerQualitySummaryId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ElectricPowerQualitySummary/" + electricPowerQualitySummaryId; - exportEntry(electricPowerQualitySummaryService.findEntryType(0L, 0L, electricPowerQualitySummaryId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(electricPowerQualitySummaryId, ElectricPowerQualitySummary.class), stream, exportFilter, hrefFragment); } @Override public void exportElectricPowerQualitySummarys(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ElectricPowerQualitySummary"; - exportEntries(electricPowerQualitySummaryService.findEntryTypeIterator(0L, 0L), stream, exportFilter, ElectricPowerQualitySummary.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(ElectricPowerQualitySummary.class), stream, exportFilter, ElectricPowerQualitySummary.class, hrefFragment); } // - XPath form @@ -239,13 +239,13 @@ public void exportElectricPowerQualitySummarys(Long retailCustomerId, Long usage @Override public void exportElectricPowerUsageSummarys(ServletOutputStream outputStream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ElectricPowerUsageSummary"; - exportEntries(electricPowerUsageSummaryService.findEntryTypeIterator(0L, 0L), outputStream, exportFilter, ElectricPowerQualitySummary.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(ElectricPowerUsageSummary.class), outputStream, exportFilter, ElectricPowerQualitySummary.class, hrefFragment); } @Override public void exportElectricPowerUsageSummary(long electricPowerUsageSummaryId, ServletOutputStream outputStream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ElectricPowerUsageSummary/" + electricPowerUsageSummaryId; - exportEntry(electricPowerUsageSummaryService.findEntryType(0L, 0L, electricPowerUsageSummaryId), outputStream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(electricPowerUsageSummaryId, ElectricPowerUsageSummary.class), outputStream, exportFilter, hrefFragment); } @@ -271,13 +271,13 @@ public void exportElectricPowerUsageSummarys(Long retailCustomerId, Long usagePo public void exportIntervalBlock(Long intervalBlockId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/IntervalBlock/" + intervalBlockId; - exportEntry(intervalBlockService.findEntryType(0L, 0L, 0L, intervalBlockId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(intervalBlockId, IntervalBlock.class), stream, exportFilter, hrefFragment); } @Override public void exportIntervalBlocks(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/IntervalBlock"; - exportEntries(intervalBlockService.findEntryTypeIterator(0L, 0L, 0L), stream, exportFilter, IntervalBlock.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(IntervalBlock.class), stream, exportFilter, IntervalBlock.class, hrefFragment); } @@ -302,13 +302,13 @@ public void exportIntervalBlocks(Long retailCustomerId, Long usagePointId, Long @Override public void exportMeterReadings(ServletOutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/MeterReading"; - exportEntries(meterReadingService.findEntryTypeIterator(), stream, exportFilter, MeterReading.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(MeterReading.class), stream, exportFilter, MeterReading.class, hrefFragment); } @Override public void exportMeterReading(long meterReadingId, ServletOutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/MeterReading/" + meterReadingId; - exportEntry(meterReadingService.findEntryType(meterReadingId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(meterReadingId, MeterReading.class), stream, exportFilter, hrefFragment); } // - XPath @@ -333,13 +333,13 @@ public void exportMeterReadings(Long retailCustomerId, Long usagePointId, @Override public void exportReadingType(Long readingTypeId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ReadingType/" + readingTypeId; - exportEntry(readingTypeService.findEntryType(0L, 0L, 0L, readingTypeId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(readingTypeId, ReadingType.class), stream, exportFilter, hrefFragment); } @Override public void exportReadingTypes(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/ReadingType"; - exportEntries(readingTypeService.findEntryTypeIterator(0L, 0L), stream, exportFilter, ReadingType.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(ReadingType.class), stream, exportFilter, ReadingType.class, hrefFragment); } // XPath form @@ -383,14 +383,14 @@ public void exportRetailCustomers(OutputStream stream, ExportFilter exportFilter public void exportSubscription(Long subscriptionId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/Subscription/" + subscriptionId; - exportEntry(subscriptionService.findEntryType(0L, subscriptionId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(subscriptionId, Subscription.class), stream, exportFilter, hrefFragment); } @Override public void exportSubscriptions(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/Subscription"; - exportEntries(subscriptionService.findEntryTypeIterator(0L), stream, exportFilter, RetailCustomer.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(Subscription.class), stream, exportFilter, RetailCustomer.class, hrefFragment); } // - XPath form @@ -415,13 +415,13 @@ public void exportSubscriptions(Long retailCustomerId, OutputStream stream, public void exportTimeConfiguration(Long timeConfigurationId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/TimeConfiguration/" + timeConfigurationId; - exportEntry(timeConfigurationService.findEntryType(0L, 0L, timeConfigurationId, exportFilter), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(timeConfigurationId, TimeConfiguration.class), stream, exportFilter, hrefFragment); } @Override public void exportTimeConfigurations(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/TimeConfiguration"; - exportEntries(timeConfigurationService.findEntryTypeIterator(0L, 0L, exportFilter), stream, exportFilter, TimeConfiguration.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(TimeConfiguration.class), stream, exportFilter, TimeConfiguration.class, hrefFragment); } // - XPath form @@ -448,14 +448,14 @@ public void exportTimeConfigurations(Long retailCustomerId, Long usagePointId, public void exportUsagePoint(Long usagePointId, OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/UsagePoint/" + usagePointId; - exportEntry(usagePointService.findEntryType(usagePointId), stream, exportFilter, hrefFragment); + exportEntry(resourceService.findEntryType(usagePointId, UsagePoint.class), stream, exportFilter, hrefFragment); } @Override public void exportUsagePoints(OutputStream stream, ExportFilter exportFilter) throws IOException { String hrefFragment = "/UsagePoint"; - exportEntries(usagePointService.findEntryTypeIterator(), stream, exportFilter, UsagePoint.class, hrefFragment); + exportEntries(resourceService.findEntryTypeIterator(UsagePoint.class), stream, exportFilter, UsagePoint.class, hrefFragment); } // XPath form diff --git a/src/main/java/org/energyos/espi/common/service/impl/ResourceServiceImpl.java b/src/main/java/org/energyos/espi/common/service/impl/ResourceServiceImpl.java index ecbd5c47..50e3268a 100755 --- a/src/main/java/org/energyos/espi/common/service/impl/ResourceServiceImpl.java +++ b/src/main/java/org/energyos/espi/common/service/impl/ResourceServiceImpl.java @@ -1,12 +1,15 @@ package org.energyos.espi.common.service.impl; import org.energyos.espi.common.domain.ApplicationInformation; +import org.energyos.espi.common.domain.ElectricPowerUsageSummary; import org.energyos.espi.common.domain.IdentifiedObject; import org.energyos.espi.common.domain.IntervalBlock; import org.energyos.espi.common.domain.Linkable; import org.energyos.espi.common.domain.UsagePoint; +import org.energyos.espi.common.models.atom.EntryType; import org.energyos.espi.common.repositories.ResourceRepository; import org.energyos.espi.common.service.ResourceService; +import org.energyos.espi.common.utils.EntryTypeIterator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.stereotype.Service; @@ -133,7 +136,33 @@ public void setRepository(ResourceRepository repository) { this.repository = repository; } + @Override + public EntryTypeIterator findEntryTypeIterator(Class clazz) { + List idList = repository.findAllIds(clazz); + EntryTypeIterator result = null; + try { + result = (new EntryTypeIterator(this, idList, clazz)); + } catch (Exception e) { + // TODO need a log file entry as we are going to return a null if + // it's not found + result = null; + } + return result; + } - - + @Override + public EntryType findEntryType(long id1, Class clazz) { + EntryType result = null; + try { + // TODO - this is sub-optimal (but defers the need to understand creation of an EntryType + List temp = new ArrayList(); + temp.add(id1); + result = (new EntryTypeIterator(this, temp, clazz)).nextEntry(clazz); + } catch (Exception e) { + // TODO need a log file entry as we are going to return a null if + // it's not found + result = null; + } + return result; + } }