本文整理汇总了Java中org.apache.olingo.commons.api.http.HttpStatusCode.NOT_IMPLEMENTED属性的典型用法代码示例。如果您正苦于以下问题:Java HttpStatusCode.NOT_IMPLEMENTED属性的具体用法?Java HttpStatusCode.NOT_IMPLEMENTED怎么用?Java HttpStatusCode.NOT_IMPLEMENTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.olingo.commons.api.http.HttpStatusCode
的用法示例。
在下文中一共展示了HttpStatusCode.NOT_IMPLEMENTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFunctionParameters
private Map<String, Parameter> getFunctionParameters(final EdmFunction function,
final List<UriParameter> parameters, final UriInfoResource uriInfo) throws DataProviderException {
Map<String, Parameter> values = new HashMap<String, Parameter>();
for (final UriParameter parameter : parameters) {
if (parameter.getExpression() != null && !(parameter.getExpression() instanceof Literal)) {
throw new DataProviderException("Expression in function-parameter value is not supported yet!",
HttpStatusCode.NOT_IMPLEMENTED);
}
final EdmParameter edmParameter = function.getParameter(parameter.getName());
final String text = parameter.getAlias() == null ?
parameter.getText() :
uriInfo.getValueForAlias(parameter.getAlias());
if (text != null) {
try {
values.put(parameter.getName(),
odata.createFixedFormatDeserializer().parameter(text, edmParameter));
} catch (final DeserializerException e) {
throw new DataProviderException("Invalid function parameter.", HttpStatusCode.BAD_REQUEST, e);
}
}
}
return values;
}
示例2: primitiveAction
/**
* Performs the named action (i.e., does nothing, currently) and returns the primitive-type result.
* @param name name of the action
* @param parameters parameters of the action
*/
protected static Property primitiveAction(final String name, final Map<String, Parameter> parameters)
throws DataProviderException {
if ("UARTString".equals(name)) {
return DataCreator.createPrimitive(null, "UARTString string value");
} else if ("UARTByteNineParam".equals(name)) {
return FunctionData.primitiveComplexFunction("UFNRTByteNineParam", parameters, null);
}else if("_A_RTTimeOfDay_".equals(name)){
Parameter paramTimeOfDay = parameters.get("ParameterTimeOfDay");
Calendar timeOfDay = Calendar.getInstance();
if (paramTimeOfDay != null && !paramTimeOfDay.isNull()) {
timeOfDay = (Calendar) paramTimeOfDay.asPrimitive();
}
return DataCreator.createPrimitive("ParameterTimeOfDay", timeOfDay);
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例3: primitiveBoundAction
protected static Property primitiveBoundAction(final String name, final Map<String, Parameter> parameters,
final Map<String, EntityCollection> data, final EdmEntitySet edmEntitySet, final List<UriParameter> keyList)
throws DataProviderException {
List<Object> keyPropertyValues = new ArrayList<Object>();
List<String> keyPropertyNames = new ArrayList<String>();
if ("BAETTwoPrimRTString".equals(name)) {
if (!keyList.isEmpty()) {
setBindingPropertyKeyNameAndValue(keyList, edmEntitySet, keyPropertyValues, keyPropertyNames);
EntityCollection entityCollection = data.get(edmEntitySet.getName());
Entity entity = getSpecificEntity1(entityCollection, keyPropertyValues, keyPropertyNames);
Property property = entity.getProperty("PropertyString");
return property;
}
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例4: primitiveCollectionBoundAction
protected static Property primitiveCollectionBoundAction(final String name, final Map<String, Parameter> parameters,
final Map<String, EntityCollection> data,
EdmEntitySet edmEntitySet, List<UriParameter> keyList, final OData oData) throws DataProviderException {
List<Object> collectionValues = new ArrayList<Object>();
if ("BAETTwoPrimRTCollString".equals(name)) {
EdmPrimitiveType strType = oData.createPrimitiveTypeInstance(EdmPrimitiveTypeKind.String);
try {
String strValue1 = strType.valueToString("ABC", false, 100, null, null, false);
collectionValues.add(strValue1);
String strValue2 = strType.valueToString("XYZ", false, 100, null, null, false);
collectionValues.add(strValue2);
} catch (EdmPrimitiveTypeException e) {
throw new DataProviderException("EdmPrimitiveTypeException", HttpStatusCode.BAD_REQUEST, e);
}
return new Property(null, name, ValueType.COLLECTION_PRIMITIVE, collectionValues);
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例5: complexCollectionAction
protected static Property complexCollectionAction(final String name, final Map<String, Parameter> parameters)
throws DataProviderException {
if ("UARTCollCTTwoPrimParam".equals(name)) {
List<ComplexValue> complexCollection = new ArrayList<ComplexValue>();
final Parameter paramInt16 = parameters.get("ParameterInt16");
final Short number = paramInt16 == null || paramInt16.isNull() ? 0 : (Short) paramInt16.asPrimitive();
if (number >= 1) {
complexCollection.add(createCTTwoPrimComplexProperty(null, (short) 16, "Test123").asComplex());
}
if (number >= 2) {
complexCollection.add(createCTTwoPrimComplexProperty(null, (short) 17, "Test456").asComplex());
}
if (number >= 3) {
complexCollection.add(createCTTwoPrimComplexProperty(null, (short) 18, "Test678").asComplex());
}
return new Property(null, name, ValueType.COLLECTION_COMPLEX, complexCollection);
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例6: entityCollectionFunction
protected static EntityCollection entityCollectionFunction(final String name,
final Map<String, Parameter> parameters, final Map<String, EntityCollection> data)
throws DataProviderException {
if (name.equals("UFCRTCollETTwoKeyNavParam")) {
final List<Entity> esTwoKeyNav = data.get("ESTwoKeyNav").getEntities();
EntityCollection result = new EntityCollection();
final int endIndex = parameters.isEmpty() ? 0 : getParameterInt16(parameters);
result.getEntities().addAll(
esTwoKeyNav.subList(0,
endIndex < 0 ? 0 : endIndex > esTwoKeyNav.size() ? esTwoKeyNav.size() : endIndex));
return result;
} else if (name.equals("UFCRTCollETMixPrimCollCompTwoParam")) {
return data.get("ESMixPrimCollComp");
} else if (name.equals("UFCRTCollETMedia")) {
return data.get("ESMedia");
} else {
throw new DataProviderException("Function " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
}
示例7: read
public Entity read(final EdmEntityType edmEntityType, final EntityCollection entitySet,
final List<UriParameter> keys) throws DataProviderException {
try {
for (final Entity entity : entitySet.getEntities()) {
boolean found = true;
for (final UriParameter key : keys) {
EdmKeyPropertyRef refType = edmEntityType.getKeyPropertyRef(key.getName());
Object value = findPropertyRefValue(entity, refType);
final EdmProperty property = refType.getProperty();
final EdmPrimitiveType type = (EdmPrimitiveType) property.getType();
if (key.getExpression() != null && !(key.getExpression() instanceof Literal)) {
throw new DataProviderException("Expression in key value is not supported yet!",
HttpStatusCode.NOT_IMPLEMENTED);
}
final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(),
Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
if (!value.equals(keyValue)) {
found = false;
break;
}
}
if (found) {
return entity;
}
}
return null;
} catch (final EdmPrimitiveTypeException e) {
throw new DataProviderException("Wrong key!", HttpStatusCode.BAD_REQUEST, e);
}
}
示例8: readDataFromEntity
public Entity readDataFromEntity(final EdmEntityType edmEntityType,
final List<UriParameter> keys) throws DataProviderException {
EntityCollection coll = data.get(edmEntityType.getName());
List<Entity> entities = coll.getEntities();
try {
for (final Entity entity : entities) {
boolean found = true;
for (final UriParameter key : keys) {
EdmKeyPropertyRef refType = edmEntityType.getKeyPropertyRef(key.getName());
Object value = findPropertyRefValue(entity, refType);
final EdmProperty property = refType.getProperty();
final EdmPrimitiveType type = (EdmPrimitiveType) property.getType();
if (key.getExpression() != null && !(key.getExpression() instanceof Literal)) {
throw new DataProviderException("Expression in key value is not supported yet!",
HttpStatusCode.NOT_IMPLEMENTED);
}
final String text = key.getAlias() == null ? key.getText() : ((Literal) key.getExpression()).getText();
final Object keyValue = type.valueOfString(type.fromUriLiteral(text),
property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
property.isUnicode(),
Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
if (!value.equals(keyValue)) {
found = false;
break;
}
}
if (found) {
return entity;
}
}
return null;
} catch (final EdmPrimitiveTypeException e) {
throw new DataProviderException("Wrong key!", HttpStatusCode.BAD_REQUEST, e);
}
}
示例9: complexAction
protected static Property complexAction(final String name, final Map<String, Parameter> parameters)
throws DataProviderException {
if ("UARTCTTwoPrimParam".equals(name)) {
Parameter paramInt16 = parameters.get("ParameterInt16");
final Short number = paramInt16 == null || paramInt16.isNull() ?
(short) 32767 :
(Short) paramInt16.asPrimitive();
return createCTTwoPrimComplexProperty(name, number, "UARTCTTwoPrimParam string value");
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例10: complexBoundAction
protected static Property complexBoundAction(final String name, final Map<String, Parameter> parameters,
final Map<String, EntityCollection> data,
EdmEntitySet edmEntitySet, List<UriParameter> keyList)
throws DataProviderException {
if ("BAETTwoKeyNavCTBasePrimCompNavCTTwoBasePrimCompNavRTCTTwoBasePrimCompNav".equals(name)) {
if (!keyList.isEmpty()) {
return DataCreator.createComplex(name,
ComplexTypeProvider.nameCTTwoBasePrimCompNav.getFullQualifiedNameAsString(),
DataCreator.createPrimitive("PropertyInt16", 10),
createKeyNavAllPrimComplexValue("PropertyComp"));
}
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例11: entityBoundActionWithNavigation
protected static EntityActionResult entityBoundActionWithNavigation(final String name,
final Map<String, Parameter> parameters,
final Map<String, EntityCollection> data, List<UriParameter> keyList,
EdmEntitySet edmEntitySet, EdmNavigationProperty navProperty)
throws DataProviderException {
List<Object> keyPropertyValues = new ArrayList<Object>();
List<String> keyPropertyNames = new ArrayList<String>();
if ("BAETTwoKeyNavRTETTwoKeyNavParam".equals(name)) {
if (!keyList.isEmpty()) {
setBindingPropertyKeyNameAndValue(keyList, edmEntitySet, keyPropertyValues, keyPropertyNames);
EntityCollection entityCollection = data.get(edmEntitySet.getName());
Entity entity = getSpecificEntity(entityCollection, keyPropertyValues, keyPropertyNames);
Link link = entity.getNavigationLink(navProperty.getName());
Entity inlineEntity = link.getInlineEntity();
ComplexValue complexValue = inlineEntity.getProperty("PropertyComp").asComplex();
List<Property> complexProperties = complexValue.getValue();
Iterator<Property> itr = complexProperties.iterator();
Parameter actionParam = parameters.get("PropertyComp");
Property actionProp = actionParam.asComplex().getValue().get(0);
while (itr.hasNext()) {
Property property = itr.next();
if (property.getName().equals(actionProp.getName())) {
property.setValue(actionProp.getValueType(), actionProp.getValue());
break;
}
}
return new EntityActionResult().setEntity(inlineEntity);
}
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例12: entityCollectionBoundAction
protected static EntityCollection entityCollectionBoundAction(final String name,
final Map<String, Parameter> parameters,
Map<String, EntityCollection> data, final OData oData, final Edm edm, EdmEntitySet edmEntitySet)
throws DataProviderException {
if ("BAESTwoKeyNavRTESTwoKeyNav".equals(name)) {
EntityCollection collection = data.get(edmEntitySet.getName());
collection.getEntities().add(createETTwoKeyNav((short)111, "newValue", oData, edm));
return collection;
}
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例13: entityCollectionBoundActionWithNav
protected static EntityCollection entityCollectionBoundActionWithNav(final String name,
final Map<String, Parameter> parameters, Map<String, EntityCollection> data,
final OData oData, final Edm edm, EdmEntitySet edmEntitySet, EdmNavigationProperty navProperty)
throws DataProviderException {
throw new DataProviderException("Action " + name + " is not yet implemented.",
HttpStatusCode.NOT_IMPLEMENTED);
}
示例14: findFreeComposedKey
private Map<String, Object> findFreeComposedKey(final List<Entity> entities,
final EdmEntityType entityType) throws DataProviderException {
// Weak key construction
final HashMap<String, Object> keys = new HashMap<String, Object>();
for (final String keyName : entityType.getKeyPredicateNames()) {
final FullQualifiedName typeName =
entityType.getProperty(keyName).getType().getFullQualifiedName();
Object newValue;
if (EdmPrimitiveTypeKind.Int16.getFullQualifiedName().equals(typeName)) {
newValue = (short) KEY_INT_16.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = (short) KEY_INT_16.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.Int32.getFullQualifiedName().equals(typeName)) {
newValue = KEY_INT_32.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = KEY_INT_32.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
// Integer keys
newValue = KEY_INT_64.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = KEY_INT_64.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.String.getFullQualifiedName().equals(typeName)) {
// String keys
newValue = String.valueOf(KEY_STRING.incrementAndGet());
while (!isFree(newValue, keyName, entities)) {
newValue = String.valueOf(KEY_STRING.incrementAndGet());
}
} else {
throw new DataProviderException("Key type not supported", HttpStatusCode.NOT_IMPLEMENTED);
}
keys.put(keyName, newValue);
}
return keys;
}
示例15: findFreeComposedKey
private Map<String, Object> findFreeComposedKey(final List<Entity> entities, final EdmEntityType entityType)
throws DataProviderException {
// Weak key construction
final HashMap<String, Object> keys = new HashMap<String, Object>();
List<String> keyPredicateNames = entityType.getKeyPredicateNames();
for (final String keyName : keyPredicateNames) {
EdmType type = entityType.getProperty(keyName).getType();
FullQualifiedName typeName = type.getFullQualifiedName();
if (type instanceof EdmTypeDefinition) {
typeName = ((EdmTypeDefinition) type).getUnderlyingType().getFullQualifiedName();
}
Object newValue;
if (EdmPrimitiveTypeKind.Int16.getFullQualifiedName().equals(typeName)) {
newValue = (short) KEY_INT_16.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = (short) KEY_INT_16.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.Int32.getFullQualifiedName().equals(typeName)) {
newValue = KEY_INT_32.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = KEY_INT_32.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.Int64.getFullQualifiedName().equals(typeName)) {
// Integer keys
newValue = KEY_INT_64.incrementAndGet();
while (!isFree(newValue, keyName, entities)) {
newValue = KEY_INT_64.incrementAndGet();
}
} else if (EdmPrimitiveTypeKind.String.getFullQualifiedName().equals(typeName)) {
// String keys
newValue = String.valueOf(KEY_STRING.incrementAndGet());
while (!isFree(newValue, keyName, entities)) {
newValue = String.valueOf(KEY_STRING.incrementAndGet());
}
} else if (type instanceof EdmEnumType) {
/* In case of an enum key we only support composite keys. This way we can 0 as a key */
if (keyPredicateNames.size() <= 1) {
throw new DataProviderException("Single Enum as key not supported", HttpStatusCode.NOT_IMPLEMENTED);
}
newValue = new Short((short) 1);
} else {
throw new DataProviderException("Key type not supported", HttpStatusCode.NOT_IMPLEMENTED);
}
keys.put(keyName, newValue);
}
return keys;
}