/** * Whether the given type declaration is GWT-transient. * * @param declaration The type declaration. * @return Whether the given tyep declaration is GWT-transient. */ protected boolean isFacetExcluded(HasFacets declaration) { return !FacetFilter.accept(declaration); }
/** * Whether the given type declaration is AMF-transient. * * @param declaration The type declaration. * @return Whether the given tyep declaration is AMF-transient. */ protected boolean isFacetExcluded(HasFacets declaration) { return !FacetFilter.accept(declaration); }
public static <T extends HasFacets> Collection<T> filteredCollection(Collection<T> list) { FacetFilter filter = FACET_FILTER.get(); if (filter == null) { return list; } ArrayList<T> filtered = new ArrayList<T>(list); Iterator<T> iterator = filtered.iterator(); while (iterator.hasNext()) { T item = iterator.next(); if (item != null && !filter.accept(item)) { iterator.remove(); } } return filtered; }
public static <K,V> Map<K,V> filteredMap(Map<K, V> map) { FacetFilter filter = FACET_FILTER.get(); if (filter == null) { return map; } LinkedHashMap<K, V> filtered = new LinkedHashMap<K, V>(map); Iterator<Map.Entry<K, V>> iterator = filtered.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = iterator.next(); HasFacets item = entry.getKey() instanceof HasFacets ? (HasFacets) entry.getKey() : entry.getValue() instanceof HasFacets ? (HasFacets) entry.getValue() : null; if (item != null && !filter.accept(item)) { iterator.remove(); } } return filtered; }
protected Iterator<EndpointInterface> getLoop(TemplateModel model) throws TemplateException { WsdlInfo wsdl = this.wsdl; if (wsdl == null) { throw new MissingParameterException("wsdl"); } Collection<EndpointInterface> eis = new ArrayList<EndpointInterface>(wsdl.getEndpointInterfaces()); if (considerFacets) { Iterator<EndpointInterface> vit = eis.iterator(); while (vit.hasNext()) { EndpointInterface next = vit.next(); if (!FacetFilter.accept(next)) { vit.remove(); } } } return eis.iterator(); }
protected Iterator<WebMethod> getLoop(TemplateModel model) throws TemplateException { EndpointInterface endpointInterface = this.endpointInterface; if (endpointInterface == null) { throw new MissingParameterException("endpointInterface"); } Collection<WebMethod> webMethods = endpointInterface.getWebMethods(); if (considerFacets) { Iterator<WebMethod> vit = webMethods.iterator(); while (vit.hasNext()) { if (!FacetFilter.accept(vit.next())) { vit.remove(); } } } return webMethods.iterator(); }
/** * Returns the qname of the element that has the first parameter as the namespace, the second as the element. * * @param list The arguments. * @return The qname. */ public Object exec(List list) throws TemplateModelException { if (list.size() < 1) { throw new TemplateModelException("The IsFacetExcluded method must have a declaration as a parameter."); } TemplateModel from = (TemplateModel) list.get(0); Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from); if (unwrapped instanceof Collection) { if (!((Collection)unwrapped).isEmpty()) { for (Object item : (Collection) unwrapped) { if (HasFacets.class.isInstance(item) && !FacetFilter.accept((HasFacets) item)) { return false; } } return true; } return false; } else { return HasFacets.class.isInstance(unwrapped) && !FacetFilter.accept((HasFacets) unwrapped); } }
protected Iterator<List<ResourceMethod>> getLoop(TemplateModel model) throws TemplateException { TreeMap<String, List<ResourceMethod>> resourcesByPath = new TreeMap<String, List<ResourceMethod>>(new ResourceMethodPathComparator()); for (RootResource rootResource : getModel().getRootResources()) { for (ResourceMethod resource : rootResource.getResourceMethods(true)) { if (considerFacets && !FacetFilter.accept(resource)) { continue; } String path = resource.getFullpath(); List<ResourceMethod> resourceList = resourcesByPath.get(path); if (resourceList == null) { resourceList = new ArrayList<ResourceMethod>(); resourcesByPath.put(path, resourceList); } resourceList.add(resource); } } return resourcesByPath.values().iterator(); }
private void gatherFacets(ResourceMethod decl, Set<Facet> facets) { if (FacetFilter.accept(decl)) { if (decl != null) { DocumentationGroup documentationGroup = decl.getAnnotation(DocumentationGroup.class); if (documentationGroup != null) { for (String name : documentationGroup.value()) { facets.add(new Facet(DocumentationGroup.class.getName(), name)); } } else { gatherDocumentationGroupFacets(decl.getParent(), facets); } } gatherFacets((Declaration) decl, facets); } }
private void aggregateAttributes(List<Accessor> accessors, TypeDefinition typeDef) { if (!typeDef.isBaseObject()) { XmlType baseType = typeDef.getBaseType(); if (baseType instanceof XmlClassType) { aggregateAttributes(accessors, ((XmlClassType)baseType).getTypeDefinition()); } } for (Attribute attribute : typeDef.getAttributes()) { if (FacetFilter.accept(attribute) && !OVERRIDE_CHECK.overridesAnother(attribute)) { accessors.add(attribute); } } }
private void aggregateElements(List<Accessor> accessors, TypeDefinition typeDef) { if (!typeDef.isBaseObject()) { XmlType baseType = typeDef.getBaseType(); if (baseType instanceof XmlClassType) { aggregateElements(accessors, ((XmlClassType)baseType).getTypeDefinition()); } } for (Element element : typeDef.getElements()) { if (FacetFilter.accept(element) && !OVERRIDE_CHECK.overridesAnother(element)) { accessors.add(element); } } }
HashSet<String> foundFaults = new HashSet<String>(); for (EndpointInterface ei : wsdlInfo.getEndpointInterfaces()) { if (!considerFacets || FacetFilter.accept(ei)) { Collection<WebMethod> webMethods = ei.getWebMethods(); for (WebMethod method : webMethods) {
private Value findValue(TypeDefinition typeDef) { if (typeDef.getValue() != null && FacetFilter.accept(typeDef.getValue())) { return typeDef.getValue(); } else if (typeDef.isBaseObject()) { return null; } else { XmlType baseType = typeDef.getBaseType(); return baseType instanceof XmlClassType ? findValue(((XmlClassType)baseType).getTypeDefinition()) : null; } }
if (FacetFilter.accept(ei)) { for (WebMethod webMethod : ei.getWebMethods()) { if (FacetFilter.accept(webMethod)) { for (WebMessage webMessage : webMethod.getMessages()) { if (webMessage instanceof RequestWrapper) { if (FacetFilter.accept(ei)) { model.put("endpointInterface", ei); for (SchemaInfo schemaInfo : model.getNamespacesToSchemas().values()) { for (TypeDefinition typeDefinition : schemaInfo.getTypeDefinitions()) { if (FacetFilter.accept(typeDefinition)) { if (useServerSide(typeDefinition, matcher)) { SourcePosition position = typeDefinition.getPosition(); for (SchemaInfo schemaInfo : model.getNamespacesToSchemas().values()) { for (TypeDefinition typeDefinition : schemaInfo.getTypeDefinitions()) { if (FacetFilter.accept(typeDefinition)) { model.put("type", typeDefinition); URL template = typeDefinition.isEnum() ? jsonEnumTypeTemplate : typeDefinition.isSimple() ? jsonSimpleTypeTemplate : jsonComplexTypeTemplate;