本文整理汇总了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;
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例9: getAnnotations
import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public Iterable<? extends NamespacedAnnotation<?>> getAnnotations() {
return annotations;
}
示例10: getAnnotationElements
import org.odata4j.core.NamespacedAnnotation; //导入依赖的package包/类
public Iterable<? extends NamespacedAnnotation<?>> getAnnotationElements() {
return annotationElements;
}
示例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;
}
示例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.");
}
示例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;
}
示例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);