This project has retired. For details please refer to its Attic page.
PublicationHelper xref
View Javadoc
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 at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * 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 and
14   * limitations under the License.
15   *
16   */
17  package org.apache.juddi.api.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Iterator;
21  import java.util.List;
22  
23  import javax.persistence.EntityManager;
24  
25  import org.apache.juddi.mapping.MappingModelToApi;
26  import org.apache.juddi.model.UddiEntityPublisher;
27  import org.apache.juddi.query.FindBusinessByPublisherQuery;
28  import org.apache.juddi.query.FindPublisherAssertionByBusinessQuery;
29  import org.uddi.api_v3.AssertionStatusItem;
30  import org.uddi.api_v3.CompletionStatus;
31  import org.uddi.v3_service.DispositionReportFaultMessage;
32  
33  /**
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   */
38  public class PublicationHelper {
39  
40  	public static 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);
42  
43  		List<?> businessKeysFound = null;
44  		businessKeysFound = FindBusinessByPublisherQuery.select(em, null, publisher, businessKeysFound);
45  		
46  		List<org.apache.juddi.model.PublisherAssertion> pubAssertionList = FindPublisherAssertionByBusinessQuery.select(em, businessKeysFound, completionStatus);
47                  if (pubAssertionList==null)
48                      return result;
49  		for(org.apache.juddi.model.PublisherAssertion modelPubAssertion : pubAssertionList) {
50  			org.uddi.api_v3.AssertionStatusItem apiAssertionStatusItem = new org.uddi.api_v3.AssertionStatusItem();
51  
52  			MappingModelToApi.mapAssertionStatusItem(modelPubAssertion, apiAssertionStatusItem, businessKeysFound);
53  			
54  			result.add(apiAssertionStatusItem);
55  		}
56  		
57  		return result;
58  	}
59  	
60  
61  
62  }