1/*2 * Copyright 2001-2008 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 *16 */17package org.apache.juddi.api.impl;
1819import java.util.ArrayList;
20import java.util.Iterator;
21import java.util.List;
2223import javax.persistence.EntityManager;
2425import org.apache.juddi.mapping.MappingModelToApi;
26import org.apache.juddi.model.UddiEntityPublisher;
27import org.apache.juddi.query.FindBusinessByPublisherQuery;
28import org.apache.juddi.query.FindPublisherAssertionByBusinessQuery;
29import org.uddi.api_v3.AssertionStatusItem;
30import org.uddi.api_v3.CompletionStatus;
31import org.uddi.v3_service.DispositionReportFaultMessage;
3233/**34 * Used to factor out publication functionality that is used in more than one spot.35 * 36 * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>37 */38publicclassPublicationHelper {
3940publicstatic List<AssertionStatusItem> getAssertionStatusItemList(UddiEntityPublisher publisher, CompletionStatus completionStatus, EntityManager em) throws DispositionReportFaultMessage {
41 List<org.uddi.api_v3.AssertionStatusItem> result = new ArrayList<org.uddi.api_v3.AssertionStatusItem>(0);
4243 List<?> businessKeysFound = null;
44 businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, businessKeysFound);
4546 List<org.apache.juddi.model.PublisherAssertion> pubAssertionList = FindPublisherAssertionByBusinessQuery.select(em, businessKeysFound, completionStatus);
47if (pubAssertionList==null)
48return result;
49for(org.apache.juddi.model.PublisherAssertion modelPubAssertion : pubAssertionList) {
50 org.uddi.api_v3.AssertionStatusItem apiAssertionStatusItem = new org.uddi.api_v3.AssertionStatusItem();
5152 MappingModelToApi.mapAssertionStatusItem(modelPubAssertion, apiAssertionStatusItem, businessKeysFound);
5354 result.add(apiAssertionStatusItem);
55 }
5657return result;
58 }
59606162 }