当前位置: 首页>>代码示例>>Java>>正文


Java NamespacedAnnotation类代码示例

本文整理汇总了Java中org.odata4j.core.NamespacedAnnotation的典型用法代码示例。如果您正苦于以下问题:Java NamespacedAnnotation类的具体用法?Java NamespacedAnnotation怎么用?Java NamespacedAnnotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NamespacedAnnotation类属于org.odata4j.core包,在下文中一共展示了NamespacedAnnotation类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setDefaultValue

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
/**
 * デフォルト値の設定.
 * @param ep EdmProperty
 * @param propName プロパティ名
 * @param op OProperty
 * @param metadata EdmDataServicesスキーマ定義
 * @return Oproperty
 */
protected OProperty<?> setDefaultValue(EdmProperty ep, String propName, OProperty<?> op, EdmDataServices metadata) {
    // スキーマ上定義されているのに入力の存在しない Property
    // デフォルト値が定義されていればそれをいれる。
    // ComplexTypeそのものの項目、または配列の項目であればデフォルト値は設定しない
    NamespacedAnnotation<?> annotation = ep.findAnnotation(Common.P_NAMESPACE.getUri(),
            Property.P_IS_DECLARED.getName());
    if (annotation != null && !(Boolean.valueOf(annotation.getValue().toString()))) {
        return null;
    }
    if (ep.getType().isSimple() && !ep.getCollectionKind().equals(CollectionKind.List)
            && ep.getDefaultValue() != null) {
        op = generateDefautlProperty(ep);
    } else if (ep.isNullable()) {
        // nullableがtrueであれば。nullの入ったプロパティ
        // TODO これでいいのか?
        op = OProperties.null_(propName, ep.getType().getFullyQualifiedTypeName());
    } else {
        // nullableがfalseであれば。エラーとする
        throw PersoniumCoreException.OData.INPUT_REQUIRED_FIELD_MISSING.params(propName);
    }
    return op;
}
 
开发者ID:personium,项目名称:personium-core,代码行数:31,代码来源:AbstractODataResource.java

示例2: validateProperty

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
/**
 * プロパティ項目の値をチェックする.
 * @param ep EdmProperty
 * @param propName プロパティ名
 * @param op OProperty
 */
protected void validateProperty(EdmProperty ep, String propName, OProperty<?> op) {
    for (NamespacedAnnotation<?> annotation : ep.getAnnotations()) {
        if (annotation.getName().equals(Common.P_FORMAT)) {
            String pFormat = annotation.getValue().toString();
            // 正規表現チェックの場合
            if (pFormat.startsWith(Common.P_FORMAT_PATTERN_REGEX)) {
                validatePropertyRegEx(propName, op, pFormat);
            } else if (pFormat.equals(Common.P_FORMAT_PATTERN_URI)) {
                validatePropertyUri(propName, op);
            } else if (pFormat.startsWith(Common.P_FORMAT_PATTERN_SCHEMA_URI)) {
                validatePropertySchemaUri(propName, op);
            } else if (pFormat.startsWith(Common.P_FORMAT_PATTERN_CELL_URL)) {
                validatePropertyCellUrl(propName, op);
            } else if (pFormat.startsWith(Common.P_FORMAT_PATTERN_USUSST)) {
                validatePropertyUsusst(propName, op, pFormat);
            } else if (pFormat.startsWith(Common.P_FORMAT_PATTERN_MESSAGE_REQUEST_RELATION)) {
                validatePropertyMessageRequestRelation(propName, op);
            }
        }
    }
}
 
开发者ID:personium,项目名称:personium-core,代码行数:28,代码来源:AbstractODataResource.java

示例3: writeAnnotation

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
private static void writeAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer,
      String prefix) {
    String prefix1 = prefix;
    for (NamespacedAnnotation<?> a : annotList) {
      if (a instanceof EdmAnnotationAttribute) {
        String prefix2 = a.getNamespace().getPrefix();
        writer.writeAttribute(
            new QName2(a.getNamespace().getUri(), a.getName(), a.getNamespace().getPrefix()),
            a.getValue() == null ? "" : a.getValue().toString());
//        if (!prefix2.equals(prefix1)) {
//          writer.writeNamespace(a.getNamespace().getPrefix(), a.getNamespace().getUri());
//        }
//        prefix1 = prefix2;
      }
    }
  }
 
开发者ID:teiid,项目名称:oreva,代码行数:17,代码来源:EdmxFormatWriter.java

示例4: writeElementInAnnotation

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
private static void writeElementInAnnotation(Iterable<? extends NamespacedAnnotation<?>> annotList, XMLWriter2 writer) {
  for (NamespacedAnnotation<?> a : annotList) {
    if (a instanceof EdmAnnotationElement) {
      EdmAnnotationElement<?> elem = (EdmAnnotationElement<?>) a;
      writer.startElement(new QName2(elem.getNamespace().getUri(), elem.getName(), elem.getNamespace().getPrefix()));
      if (elem.getNamespace().getPrefix() != null && elem.getNamespace().getUri() != null) {
        writer.writeNamespace(elem.getNamespace().getPrefix(), elem.getNamespace().getUri());
      }
      writeAnnotationAttributes(elem, writer, elem.getNamespace().getPrefix());
      writer.writeText(elem.getValue().toString().trim());
      writeAnnotationElements(elem, writer);
      writer.endElement(a.getName());
      // TODO: please don't throw an exception here.
      // this totally breaks ODataConsumer even thought it doesn't rely
      // on annotations.  A no-op is a interim approach that allows work
      // to proceed by those using queryable metadata to access annotations.
      // throw new UnsupportedOperationException("Implement element annotations");
    }
  }
}
 
开发者ID:teiid,项目名称:oreva,代码行数:21,代码来源:EdmxFormatWriter.java

示例5: findAnnotation

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
/**
 * 指定したアノテーションを取得する.
 * @param type EdmType
 * @param namespaceUri 名前空間
 * @param localName 取得対象名
 * @return namespaceUri
 */
private NamespacedAnnotation<?> findAnnotation(EdmType type, String namespaceUri, String localName) {
    if (type != null) {
        for (NamespacedAnnotation<?> annotation : type.getAnnotations()) {
            if (localName.equals(annotation.getName())) {
                String uri = annotation.getNamespace().getUri();
                if ((namespaceUri == null && uri == null) //NOPMD -To maintain readability
                        || (namespaceUri != null && namespaceUri.equals(uri))) { //NOPMD
                    return annotation;
                }
            }
        }
    }
    return null;
}
 
开发者ID:personium,项目名称:personium-core,代码行数:22,代码来源:PersoniumJsonFormatParser.java

示例6: findAnnotation

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public NamespacedAnnotation<?> findAnnotation(String namespaceUri, String localName) {
  if (annotations != null) {
    for (NamespacedAnnotation<?> annotation : annotations) {
      if (annotation.getNamespace().getUri().equals(namespaceUri) && annotation.getName().equals(localName))
        return annotation;
    }
  }
  return null;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:10,代码来源:EdmItem.java

示例7: findAnnotationElement

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public NamespacedAnnotation<?> findAnnotationElement(String namespaceUri, String name) {
  if (annotationElements != null) {
    for (NamespacedAnnotation<?> element : annotationElements) {
      if (element.getNamespace().getUri().equals(namespaceUri) && element.getName().equals(name))
        return element;

    }
  }
  return null;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:11,代码来源:EdmItem.java

示例8: getProperty

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
String getProperty(EdmEntitySet entitySet, String key) {
	Iterable<? extends NamespacedAnnotation> annotations = entitySet.getAnnotations();
	for (NamespacedAnnotation annotation:annotations) {
		PrefixedNamespace namespace = annotation.getNamespace();
		if (namespace.getUri().equals(SAPURI)) {
			if (annotation.getName().equalsIgnoreCase(key)) {
				return (String)annotation.getValue();
			}
		}
	}
	return null;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:13,代码来源:SAPMetadataProcessor.java

示例9: getAnnotations

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public Iterable<? extends NamespacedAnnotation<?>> getAnnotations() {
  return annotations;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:4,代码来源:EdmItem.java

示例10: getAnnotationElements

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public Iterable<? extends NamespacedAnnotation<?>> getAnnotationElements() {
  return annotationElements;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:4,代码来源:EdmItem.java

示例11: getAnnotationValueOverride

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
@Override
public Object getAnnotationValueOverride(EdmItem item, NamespacedAnnotation<?> annot, boolean flatten, Locale locale, Map<String, String> options) {
  return null;
}
 
开发者ID:teiid,项目名称:oreva,代码行数:5,代码来源:InMemoryProducerExample.java

示例12: getAnnotationValueOverride

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
@Override
public Object getAnnotationValueOverride(EdmItem item, NamespacedAnnotation<?> annot, boolean flatten, Locale locale, Map<String, String> options) {
  throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:teiid,项目名称:oreva,代码行数:5,代码来源:EdmxFormatWriterTest.java

示例13: buildTable

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
@Override
protected Table buildTable(MetadataFactory mf, EdmEntitySet entitySet) {
	boolean creatable = true;
	boolean updatable = true;
	boolean deletable = true;
	boolean pageable = true;
	boolean topable = true;
	
	Table t = mf.addTable(entitySet.getName());
	
	Iterable<? extends NamespacedAnnotation> annotations = entitySet.getAnnotations();
	for (NamespacedAnnotation annotation:annotations) {
		PrefixedNamespace namespace = annotation.getNamespace();
		if (namespace.getUri().equals(SAPURI)) {
			String name = annotation.getName();
			if (name.equalsIgnoreCase("label")) { //$NON-NLS-1$
				t.setAnnotation((String)annotation.getValue());	
			}
			else if (name.equalsIgnoreCase("creatable")) { //$NON-NLS-1$
				creatable = Boolean.parseBoolean((String)annotation.getValue());	
			}
			else if (name.equalsIgnoreCase("updatable")) { //$NON-NLS-1$
				updatable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("pageable")) { //$NON-NLS-1$
				pageable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("topable")) { //$NON-NLS-1$
				topable = Boolean.parseBoolean((String)annotation.getValue());
			}
			else if (name.equalsIgnoreCase("deletable")) { //$NON-NLS-1$
				deletable = Boolean.parseBoolean((String)annotation.getValue());
			}
		}
	}
	
	t.setSupportsUpdate(creatable && updatable && deletable);
	if (!topable || !pageable) {
		// TODO: currently Teiid can not do this in fine grained manner; 
		// will be turned on by default; but user needs to turn off using the 
		// capabilities if any table does not support this feature
	}
	return t;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:45,代码来源:SAPMetadataProcessor.java

示例14: getAnnotationValueOverride

import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
/**
 * Gets an annotation value that overrides the original annotation value.
 *
 * <p>This is an experiment that allows one to localize queryable metadata.
 * Say you have an annotation called LocalizedName on your item.  When
 * the metadata is queried, the caller can supply a custom locale parameter
 * in options and this method can override the original LocalizedName with
 * the one for the given locale.
 *
 * @param item  the annotated item
 * @param annot  the annotation
 * @param options  from query
 * @return null if no override, an object with the value if there is one.
 */
Object getAnnotationValueOverride(EdmItem item, NamespacedAnnotation<?> annot, boolean flatten, Locale locale, Map<String, String> options);
 
开发者ID:teiid,项目名称:oreva,代码行数:16,代码来源:EdmDecorator.java


注:本文中的org.odata4j.core.NamespacedAnnotation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。