public void addAnnotations(CsdlEntityContainer csdlEntityContainer, FullQualifiedName containerName) { for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget().equalsIgnoreCase(containerName.getFullQualifiedNameAsString())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(csdlEntityContainer.getAnnotations(), annotation)) { csdlEntityContainer.getAnnotations().addAll(annotationGrp.getAnnotations()); } } break; } } } }
/** * Gets annotation group. * * @param target the target * @return the annotation group */ public CsdlAnnotations getAnnotationGroup(final String target, final String qualifier) { CsdlAnnotations result = null; for (CsdlAnnotations annots : getAnnotationGroups()) { if (target.equals(annots.getTarget()) && (qualifier == annots.getQualifier() || (qualifier != null && qualifier.equals(annots.getQualifier())))) { result = annots; } } return result; }
private void readAnnotationGroup(XMLEventReader reader, StartElement element, CsdlSchema schema) throws XMLStreamException { final CsdlAnnotations annotations = new CsdlAnnotations(); annotations.setTarget(attr(element, "Target")); annotations.setQualifier(attr(element, "Qualifier")); peekAnnotations(reader, element.getName().getLocalPart(), annotations); schema.getAnnotationGroups().add(annotations); }
StringUtils.substringBeforeLast(annotationGroup.getTarget(), "."))) && (StringUtils.isBlank(include.getQualifier()) || include.getQualifier().equals(annotationGroup.getQualifier()))) { final CsdlAnnotations toBeIncluded = new CsdlAnnotations(); toBeIncluded.setTarget(annotationGroup.getTarget()); toBeIncluded.setQualifier(annotationGroup.getQualifier()); for (CsdlAnnotation annotation : annotationGroup.getAnnotations()) { if (include.getTermNamespace().equals(StringUtils.substringBeforeLast(annotation.getTerm(), "."))) { toBeIncluded.getAnnotations().add(annotation);
@Override public String getTargetPath() { return annotationGroup.getTarget(); } }
/** * Gets annotation. * * @param term the term * @return the annotation */ public CsdlAnnotation getAnnotation(final String term) { CsdlAnnotation result = null; for (CsdlAnnotation annotation : getAnnotations()) { if (term.equals(annotation.getTerm())) { result = annotation; } } return result; } }
@Override public String getQualifier() { return annotationGroup.getQualifier(); }
StringUtils.substringBeforeLast(annotationGroup.getTarget(), "."))) && (StringUtils.isBlank(include.getQualifier()) || include.getQualifier().equals(annotationGroup.getQualifier()))) { final CsdlAnnotations toBeIncluded = new CsdlAnnotations(); toBeIncluded.setTarget(annotationGroup.getTarget()); toBeIncluded.setQualifier(annotationGroup.getQualifier()); for (CsdlAnnotation annotation : annotationGroup.getAnnotations()) { if (include.getTermNamespace().equals(StringUtils.substringBeforeLast(annotation.getTerm(), "."))) { toBeIncluded.getAnnotations().add(annotation);
@Override public String getTargetPath() { return annotationGroup.getTarget(); } }
/** * Gets annotation. * * @param term the term * @return the annotation */ public CsdlAnnotation getAnnotation(final String term) { CsdlAnnotation result = null; for (CsdlAnnotation annotation : getAnnotations()) { if (term.equals(annotation.getTerm())) { result = annotation; } } return result; } }
@Override public String getQualifier() { return annotationGroup.getQualifier(); }
public void addAnnotations(CsdlEnumType enumType, FullQualifiedName enumName) { for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget().equalsIgnoreCase(enumName.getFullQualifiedNameAsString())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(enumType.getAnnotations(), annotation)) { enumType.getAnnotations().addAll(annotationGrp.getAnnotations()); } } break; } } } }
protected List<EdmAnnotations> createAnnotationGroups() { final List<EdmAnnotations> edmAnnotationGroups = new ArrayList<EdmAnnotations>(); final List<CsdlAnnotations> providerAnnotations = schema.getAnnotationGroups(); if (providerAnnotations != null) { for (CsdlAnnotations annotationGroup : providerAnnotations) { FullQualifiedName targetName; if (annotationGroup.getTarget().contains(".")) { targetName = new FullQualifiedName(annotationGroup.getTarget()); } else { targetName = new FullQualifiedName(namespace, annotationGroup.getTarget()); } EdmAnnotationsImpl annotationsImpl = new EdmAnnotationsImpl(edm, annotationGroup); edmAnnotationGroups.add(annotationsImpl); edm.cacheAnnotationGroup(targetName, annotationsImpl); } } return edmAnnotationGroups; }
/** * @param structuralType * @param annotationGrp */ private void addAnnotationsToStructuralTypes(CsdlStructuralType structuralType, CsdlAnnotations annotationGrp) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(structuralType.getAnnotations(), annotation)) { structuralType.getAnnotations().addAll(annotationGrp.getAnnotations()); } } }
private void readAnnotationGroup(XMLEventReader reader, StartElement element, CsdlSchema schema) throws XMLStreamException { final CsdlAnnotations annotations = new CsdlAnnotations(); annotations.setTarget(attr(element, "Target")); annotations.setQualifier(attr(element, "Qualifier")); peekAnnotations(reader, element.getName().getLocalPart(), annotations); schema.getAnnotationGroups().add(annotations); }
/** * Gets annotation group. * * @param target the target * @return the annotation group */ public CsdlAnnotations getAnnotationGroup(final String target, final String qualifier) { CsdlAnnotations result = null; for (CsdlAnnotations annots : getAnnotationGroups()) { if (target.equals(annots.getTarget()) && (qualifier == annots.getQualifier() || (qualifier != null && qualifier.equals(annots.getQualifier())))) { result = annots; } } return result; }
public void addAnnotations(CsdlTypeDefinition typeDefinition, FullQualifiedName typeDefinitionName) { for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget().equalsIgnoreCase(typeDefinitionName.getFullQualifiedNameAsString())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(typeDefinition.getAnnotations(), annotation)) { typeDefinition.getAnnotations().addAll(annotationGrp.getAnnotations()); } } break; } } } }
protected List<EdmAnnotations> createAnnotationGroups() { final List<EdmAnnotations> edmAnnotationGroups = new ArrayList<EdmAnnotations>(); final List<CsdlAnnotations> providerAnnotations = schema.getAnnotationGroups(); if (providerAnnotations != null) { for (CsdlAnnotations annotationGroup : providerAnnotations) { FullQualifiedName targetName; if (annotationGroup.getTarget().contains(".")) { targetName = new FullQualifiedName(annotationGroup.getTarget()); } else { targetName = new FullQualifiedName(namespace, annotationGroup.getTarget()); } EdmAnnotationsImpl annotationsImpl = new EdmAnnotationsImpl(edm, annotationGroup); edmAnnotationGroups.add(annotationsImpl); edm.cacheAnnotationGroup(targetName, annotationsImpl); } } return edmAnnotationGroups; }
/** * @param entitySet * @param annotationGrp */ private void addAnnotationsToEntitySet(CsdlEntitySet entitySet, CsdlAnnotations annotationGrp) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(entitySet.getAnnotations(), annotation)) { entitySet.getAnnotations().add(annotation); } } }
private void addAnnotations(CsdlFunctionImport functionImport, FullQualifiedName entityContainerName) { List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions(); for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget(). equalsIgnoreCase(entityContainerName + "/" + functionImport.getName())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(functionImport.getAnnotations(), annotation)) { functionImport.getAnnotations().add(annotation); } } break; } } } }