@Override public String getTargetPath() { return annotationGroup.getTarget(); } }
@Override public String getTargetPath() { return annotationGroup.getTarget(); } }
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; }
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; }
/** * 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; }
/** * 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(CsdlAction action, FullQualifiedName actionName) { for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget().equalsIgnoreCase( actionName.getFullQualifiedNameAsString())) { addAnnotationsToActions(action, annotationGrp); } else { addAnnotationsToParamsOfActions(action, actionName, annotationGrp); } } } }
public void addAnnotations(CsdlFunction function, FullQualifiedName functionName) { for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget().equalsIgnoreCase( functionName.getFullQualifiedNameAsString())) { addAnnotationsToFunctions(function, annotationGrp); } else { addAnnotationsToParamsOFunctions(function, functionName, annotationGrp); } } } }
/** Check if annotations are added on navigation properties of a structural type * @param structuralType * @param typeName * @param isNavPropAnnotationsCleared * @param annotationGrp */ private void checkAnnotationsOnStructuralNavProperties(CsdlStructuralType structuralType, FullQualifiedName typeName, boolean isNavPropAnnotationsCleared, CsdlAnnotations annotationGrp) { List<CsdlNavigationProperty> navProperties = structuralType.getNavigationProperties(); for (CsdlNavigationProperty navProperty : navProperties) { if (!isNavPropAnnotationsCleared) { structuralType.getNavigationProperty(navProperty.getName()).getAnnotations().clear(); } if (annotationGrp.getTarget().equalsIgnoreCase(typeName + "/" + navProperty.getName())) { addAnnotationsToStructuralTypeNavProperties(structuralType, annotationGrp, navProperty); } } }
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; } } } }
private void addAnnotations(CsdlActionImport actionImport, 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 + "/" + actionImport.getName())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(actionImport.getAnnotations(), annotation)) { actionImport.getAnnotations().add(annotation); } } break; } } } }
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; } } } }
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; } } } }
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; } } } }
/** Check if annotations are added on properties of a structural type * @param structuralType * @param typeName * @param isPropAnnotationsCleared * @param annotationGrp */ private void checkAnnotationsOnStructuralProperties(CsdlStructuralType structuralType, FullQualifiedName typeName, boolean isPropAnnotationsCleared, CsdlAnnotations annotationGrp) { List<CsdlProperty> properties = structuralType.getProperties(); for (CsdlProperty property : properties) { if (!isPropAnnotationsCleared) { structuralType.getProperty(property.getName()).getAnnotations().clear(); } if (annotationGrp.getTarget().equalsIgnoreCase( typeName.getFullQualifiedNameAsString() + "/" + property.getName())) { addAnnotationsToStructuralTypeProperties(structuralType, annotationGrp, property); } } }
private void addAnnotations(CsdlSingleton singleton, FullQualifiedName entityContainerName) { boolean isPropAnnotationsCleared = false; boolean isNavPropAnnotationsCleared = false; CsdlEntityType entityType = fetchEntityTypeFromSingleton(singleton); if (entityType == null) { return; } List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions(); for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget(). equalsIgnoreCase(entityContainerName + "/" + singleton.getName())) { isSingletonAnnotationsIncluded = true; addAnnotationsToSingleton(singleton, annotationGrp); } else { addAnnotationsToPropertiesDerivedFromSingleton(singleton, isPropAnnotationsCleared, isNavPropAnnotationsCleared, entityType, annotationGrp); isPropAnnotationsCleared = true; isNavPropAnnotationsCleared = true; } } } }
private void addAnnotations(CsdlEntitySet entitySet, FullQualifiedName entityContainerName) { boolean isPropAnnotationsCleared = false; boolean isNavPropAnnotationsCleared = false; CsdlEntityType entityType = getCsdlEntityTypeFromEntitySet(entitySet); if (entityType == null) { return; } List<CsdlSchema> termSchemaDefinition = ((EdmProviderImpl)edm).getTermSchemaDefinitions(); for (CsdlSchema schema : termSchemaDefinition) { List<CsdlAnnotations> annotationGrps = schema.getAnnotationGroups(); for (CsdlAnnotations annotationGrp : annotationGrps) { if (annotationGrp.getTarget(). equalsIgnoreCase(entityContainerName + "/" + entitySet.getName())) { isAnnotationsIncluded = true; addAnnotationsToEntitySet(entitySet, annotationGrp); } else { addAnnotationsToEntityTypeIncludedFromES(entitySet, entityContainerName, annotationGrp, isPropAnnotationsCleared, isNavPropAnnotationsCleared, entityType); isPropAnnotationsCleared = true; isNavPropAnnotationsCleared = true; } } } }
/** * * @param singleton * @param entityContainerName2 * @param annotationGrp * @param propertyName * @param isComplexNavPropAnnotationsCleared * @param complexType */ private void addAnnotationsToComplexTypeIncludedFromSingleton(CsdlSingleton singleton, CsdlAnnotations annotationGrp, CsdlProperty propertyName, boolean isComplexNavPropAnnotationsCleared, CsdlComplexType complexType) { for (CsdlNavigationProperty complexNavPropertyName : complexType.getNavigationProperties()) { if (!isComplexNavPropAnnotationsCleared) { complexType.getNavigationProperty(complexNavPropertyName.getName()).getAnnotations().clear(); } if (annotationGrp.getTarget(). equalsIgnoreCase(entityContainerName + "/" + singleton.getName() + "/" + propertyName.getName() + "/" + complexNavPropertyName.getName())) { isSingletonAnnotationsIncluded = true; addAnnotationsToComplexTypeNavProperties(annotationGrp, complexType, complexNavPropertyName); } } }
/** Adds annotations to actions * @param action * @param actionName * @param annotationGrp */ private void addAnnotationsToParamsOfActions(CsdlAction action, FullQualifiedName actionName, CsdlAnnotations annotationGrp) { final List<CsdlParameter> parameters = action.getParameters(); for (CsdlParameter parameter : parameters) { if (annotationGrp.getTarget().equalsIgnoreCase( actionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(action.getParameter(parameter.getName()).getAnnotations(), annotation)) { action.getParameter(parameter.getName()).getAnnotations().add(annotation); } } } } }
/** Adds annotations of function parameters * @param function * @param functionName * @param annotationGrp */ private void addAnnotationsToParamsOFunctions(CsdlFunction function, FullQualifiedName functionName, CsdlAnnotations annotationGrp) { final List<CsdlParameter> parameters = function.getParameters(); for (CsdlParameter parameter : parameters) { if (annotationGrp.getTarget().equalsIgnoreCase( functionName.getFullQualifiedNameAsString() + "/" + parameter.getName())) { for (CsdlAnnotation annotation : annotationGrp.getAnnotations()) { if (!compareAnnotations(function.getParameter(parameter.getName()).getAnnotations(), annotation)) { function.getParameter(parameter.getName()).getAnnotations().add(annotation); } } } } }