Merge "Issue #2385 Fixed subscription backup web page" into development
Former-commit-id:a5df53787e
[formerly540d0e7b9c
] [formerly9e17d68bd1
] [formerlya5df53787e
[formerly540d0e7b9c
] [formerly9e17d68bd1
] [formerly472b3b10a3
[formerly9e17d68bd1
[formerly 73b5da79892dd0781638329e4dd7be56a11e642d]]]] Former-commit-id:472b3b10a3
Former-commit-id:1be34a6708
[formerly0306778ac2
] [formerly 3f1f17b8b8f7c9e5603efd120ec81f4b642d6876 [formerlyeb5b61ba85
]] Former-commit-id: dd1b63cdd7cee780019dc244e6a0393018f8ff60 [formerlya02af3bc08
] Former-commit-id:cf210025ae
This commit is contained in:
commit
56e8a04739
1 changed files with 14 additions and 3 deletions
|
@ -46,6 +46,7 @@ import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResp
|
|||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
|
||||
/**
|
||||
|
@ -60,6 +61,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/29/2013 2191 bphillip Initial implementation
|
||||
* 9/20/2013 2385 bphillip Added subscription backup functions
|
||||
* 10/2/2013 2385 bphillip Fixed subscription backup queries
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -76,7 +78,14 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
|
|||
System.getProperty("edex.home")
|
||||
+ "/data/registrySubscriptionBackup");
|
||||
|
||||
private static final String GET_SUBSCRIPTIONS_QUERY = "FROM RegistryObjectType obj where lower(obj.objectType) like '%subscription%' order by obj.id asc";
|
||||
private static final String GET_SINGLE_SUBSCRIPTIONS_QUERY = "FROM RegistryObjectType obj "
|
||||
+ "where (obj.objectType like '%SiteSubscription' "
|
||||
+ "OR obj.objectType like '%SharedSubscription') "
|
||||
+ "AND obj.id=:id";
|
||||
|
||||
private static final String GET_SUBSCRIPTIONS_QUERY = "FROM RegistryObjectType obj "
|
||||
+ "where obj.objectType like '%SiteSubscription' "
|
||||
+ "OR obj.objectType like '%SharedSubscription' order by obj.id asc";
|
||||
|
||||
/** Data access object for registry objects */
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
@ -191,12 +200,14 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
|
|||
@PathParam("subscriptionName") String subscriptionName)
|
||||
throws JAXBException {
|
||||
StringBuilder response = new StringBuilder();
|
||||
RegistryObjectType sub = registryObjectDao.getById(subscriptionName);
|
||||
List<RegistryObjectType> result = registryObjectDao.executeHQLQuery(
|
||||
GET_SINGLE_SUBSCRIPTIONS_QUERY, "id", subscriptionName);
|
||||
|
||||
if (sub == null) {
|
||||
if (CollectionUtil.isNullOrEmpty(result)) {
|
||||
response.append("Subscription with ID [").append(subscriptionName)
|
||||
.append("] not found in registry");
|
||||
} else {
|
||||
RegistryObjectType sub = result.get(0);
|
||||
if (!SUBSCRIPTION_BACKUP_DIR.exists()) {
|
||||
SUBSCRIPTION_BACKUP_DIR.mkdirs();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue