OSLC value type for property of type Map

I have this get method :


@OslcPropertyDefinition(Oslc_objectiverDomainConstants.***OBJECTIVERWEB_NAMSPACE*** + "attributes")





**public** Map<String, String> getAttributesMap() {

// **TODO** Auto-generated method stub

**return** attributesMap;


And I want to know which @OslcValueType(ValueType.?) to add for a Map <String, String > ?
I tried String and I got this error :

org.eclipse.lyo.oslc4j.core.exception.OslcCoreInvalidValueTypeException: [1;31mOSLC007: Invalid value type XML Schema defined for method getAttributesMap

Where did you find this code? I can help understand the context.
If part of a Lyo library, can you provide a link to that specific file/class from github?

it’s a project that I created with Lyo designer and now I have to modify it so that I can connect to another remote web service and serialize the content in json

@OslcValueType can only have values in the ValueType enum

Attributes can only be of the simple types (Strings, floats, etc). If you want a more complicated structure, consider using a Resource or a LocalResource ? (If you are using LyoDesigner, better to model it there to get the code more correct - I hope)

Not exactly sure what your Map is meant to represent, but such a map can be represented as a LocalResource with 2 attributes (key, value). You then define the property to have a cardinaltiy of zeroOrMany.

1 Like

The code you are modifying is the API that the clients will use. If you want the server to make further client calls to the backend, you don’t need to modify the user-facing API.

OSLC APIs don’t support raw JSON documents but use graph-based formats instead. If you receive JSON from the backend APIs, you will need to adjust the data first (easiest is to return Lyo POJOs and the ORMish component will take care of the rest).

1 Like