本文整理汇总了Java中org.apache.olingo.odata2.api.edm.Edm.DELIMITER属性的典型用法代码示例。如果您正苦于以下问题:Java Edm.DELIMITER属性的具体用法?Java Edm.DELIMITER怎么用?Java Edm.DELIMITER使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.olingo.odata2.api.edm.Edm
的用法示例。
在下文中一共展示了Edm.DELIMITER属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructETag
private <T> String constructETag(final EdmEntitySet entitySet, final T data) throws ODataException {
final EdmEntityType entityType = entitySet.getEntityType();
String eTag = null;
for (final String propertyName : entityType.getPropertyNames()) {
final EdmProperty property = (EdmProperty) entityType.getProperty(propertyName);
if (property.getFacets() != null && property.getFacets().getConcurrencyMode() == EdmConcurrencyMode.Fixed) {
final EdmSimpleType type = (EdmSimpleType) property.getType();
final String component = type.valueToString(valueAccess.getPropertyValue(data, property),
EdmLiteralKind.DEFAULT, property.getFacets());
eTag = eTag == null ? component : eTag + Edm.DELIMITER + component;
}
}
return eTag == null ? null : "W/\"" + eTag + "\"";
}
示例2: appendProperty
/**
* Appends a simple-property value to the XML stream.
* @param writer the XML stream writer
* @param prop property informations
* @param value the value of the property
* @throws XMLStreamException
* @throws EdmException
* @throws EntityProviderProducerException
*/
private void appendProperty(final XMLStreamWriter writer, final EntityPropertyInfo prop, final Object value)
throws XMLStreamException, EdmException, EntityProviderProducerException {
Object contentValue = value;
String mimeType = null;
if (prop.getMimeType() != null) {
mimeType = prop.getMimeType();
} else if (prop.getMapping() != null && prop.getMapping().getMediaResourceMimeTypeKey() != null) {
mimeType = (String) extractChildValue(value, prop.getMapping().getMediaResourceMimeTypeKey());
contentValue = extractChildValue(value, prop.getName());
}
if (mimeType != null) {
writer.writeAttribute(Edm.NAMESPACE_M_2007_08, FormatXml.M_MIME_TYPE, mimeType);
}
final EdmSimpleType type = (EdmSimpleType) prop.getType();
if (includeSimplePropertyType) {
String fqnTypeName = type.getNamespace() + Edm.DELIMITER + type.getName();
writer.writeAttribute(Edm.NAMESPACE_M_2007_08, FormatXml.ATOM_TYPE, fqnTypeName);
}
final EdmFacets facets = validateFacets ? prop.getFacets() : null;
String valueAsString = null;
try {
valueAsString = type.valueToString(contentValue, EdmLiteralKind.DEFAULT, facets);
} catch (EdmSimpleTypeException e) {
throw new EntityProviderProducerException(EdmSimpleTypeException.getMessageReference(
e.getMessageReference()).updateContent(
e.getMessageReference().getContent(), prop.getName()), e);
}
if (valueAsString == null) {
writer.writeAttribute(Edm.NAMESPACE_M_2007_08, FormatXml.ATOM_NULL, FormatXml.ATOM_VALUE_TRUE);
} else {
writer.writeCharacters(valueAsString);
}
}
示例3: createETag
protected static String createETag(final EntityInfoAggregator eia, final Map<String, Object> data)
throws EntityProviderException {
String propertyName = "";
try {
String etag = null;
Collection<EntityPropertyInfo> propertyInfos = eia.getETagPropertyInfos();
for (EntityPropertyInfo propertyInfo : propertyInfos) {
propertyName = propertyInfo.getName();
EdmType edmType = propertyInfo.getType();
if (edmType instanceof EdmSimpleType) {
EdmSimpleType edmSimpleType = (EdmSimpleType) edmType;
if (etag == null) {
etag =
edmSimpleType.valueToString(data.get(propertyInfo.getName()), EdmLiteralKind.DEFAULT, propertyInfo
.getFacets());
} else {
etag =
etag
+ Edm.DELIMITER
+ edmSimpleType.valueToString(data.get(propertyInfo.getName()), EdmLiteralKind.DEFAULT,
propertyInfo.getFacets());
}
}
}
if (etag != null) {
etag = "W/\"" + etag + "\"";
}
return etag;
} catch (EdmSimpleTypeException e) {
throw new EntityProviderProducerException(EdmSimpleTypeException.getMessageReference(
e.getMessageReference()).updateContent(e.getMessageReference().getContent(), propertyName), e);
}
}
示例4: toString
@Override
public String toString() {
try {
return namespace + Edm.DELIMITER + getName();
} catch (final EdmException e) {
return null;
}
}
示例5: toString
@Override
public String toString() {
try {
return getNamespace() + Edm.DELIMITER + getName();
} catch (final EdmException e) {
return super.toString();
}
}
示例6: getType
private static String getType(final CommonExpression expression) {
try {
final EdmType type = expression.getEdmType();
return type == null ? null : type.getNamespace() + Edm.DELIMITER + type.getName();
} catch (final EdmException e) {
return "EdmException occurred: " + e.getMessage();
}
}
示例7: readMetadata
private void readMetadata() throws IOException, EdmException, EntityProviderException {
String name = null;
String value = null;
reader.beginObject();
while (reader.hasNext()) {
name = reader.nextName();
if (FormatJson.PROPERTIES.equals(name)) {
reader.skipValue();
continue;
}
value = reader.nextString();
if (FormatJson.ID.equals(name)) {
entryMetadata.setId(value);
} else if (FormatJson.URI.equals(name)) {
entryMetadata.setUri(value);
} else if (FormatJson.TYPE.equals(name)) {
String fullQualifiedName = eia.getEntityType().getNamespace() + Edm.DELIMITER + eia.getEntityType().getName();
if (!fullQualifiedName.equals(value)) {
throw new EntityProviderException(EntityProviderException.INVALID_ENTITYTYPE.addContent(fullQualifiedName)
.addContent(value));
}
} else if (FormatJson.ETAG.equals(name)) {
entryMetadata.setEtag(value);
} else if (FormatJson.EDIT_MEDIA.equals(name)) {
mediaMetadata.setEditLink(value);
} else if (FormatJson.MEDIA_SRC.equals(name)) {
mediaMetadata.setSourceLink(value);
} else if (FormatJson.MEDIA_ETAG.equals(name)) {
mediaMetadata.setEtag(value);
} else if (FormatJson.CONTENT_TYPE.equals(name)) {
mediaMetadata.setContentType(value);
} else {
throw new EntityProviderException(EntityProviderException.INVALID_CONTENT.addContent(name).addContent(
FormatJson.METADATA));
}
}
reader.endObject();
}
示例8: readStartedElement
protected Object readStartedElement(XMLStreamReader reader, final String name, final EntityPropertyInfo propertyInfo,
final EntityTypeMapping typeMappings, final EntityProviderReadProperties readProperties)
throws EntityProviderException, EdmException {
Object result = null;
try {
reader.require(XMLStreamConstants.START_ELEMENT, Edm.NAMESPACE_D_2007_08, name);
final String nullAttribute = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, FormatXml.M_NULL);
if (!(nullAttribute == null || TRUE.equals(nullAttribute) || FALSE.equals(nullAttribute))) {
throw new EntityProviderException(EntityProviderException.COMMON);
}
if (TRUE.equals(nullAttribute)) {
if ((readProperties == null || readProperties.isValidatingFacets()) && propertyInfo.isMandatory()) {
throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY_VALUE.addContent(name));
}
reader.nextTag();
} else if (propertyInfo.isComplex()) {
final String typeAttribute = reader.getAttributeValue(Edm.NAMESPACE_M_2007_08, FormatXml.M_TYPE);
if (typeAttribute != null) {
final String expectedTypeAttributeValue =
propertyInfo.getType().getNamespace() + Edm.DELIMITER + propertyInfo.getType().getName();
if (!expectedTypeAttributeValue.equals(typeAttribute)) {
throw new EntityProviderException(EntityProviderException.INVALID_COMPLEX_TYPE.addContent(
expectedTypeAttributeValue).addContent(typeAttribute));
}
}
reader.nextTag();
Map<String, Object> name2Value = new HashMap<String, Object>();
while (reader.hasNext() && !reader.isEndElement()) {
final String childName = reader.getLocalName();
final EntityPropertyInfo childProperty =
((EntityComplexPropertyInfo) propertyInfo).getPropertyInfo(childName);
if (childProperty == null) {
throw new EntityProviderException(EntityProviderException.INVALID_PROPERTY.addContent(childName));
}
final Object value = readStartedElement(reader, childName, childProperty,
typeMappings.getEntityTypeMapping(name), readProperties);
name2Value.put(childName, value);
reader.nextTag();
}
result = name2Value;
} else {
result = convert(propertyInfo, reader.getElementText(), typeMappings.getMappingClass(name), readProperties);
}
reader.require(XMLStreamConstants.END_ELEMENT, Edm.NAMESPACE_D_2007_08, name);
return result;
} catch (XMLStreamException e) {
throw new EntityProviderException(EntityProviderException.EXCEPTION_OCCURRED.addContent(e.getClass()
.getSimpleName()), e);
}
}
示例9: getFqnTypeName
/**
* Returns full qualified name of a type of a given PropertyInfo.
* @return Full qualified name
*/
private String getFqnTypeName(final EntityComplexPropertyInfo propertyInfo) throws EdmException {
return propertyInfo.getType().getNamespace() + Edm.DELIMITER + propertyInfo.getType().getName();
}