Search in sources :

Example 1 with MapEntry

use of org.xwiki.rest.model.jaxb.MapEntry in project xwiki-platform by xwiki.

the class ModelFactory method toRestMapEntry.

public MapEntry toRestMapEntry(String key, java.lang.Object value) throws XWikiRestException {
    MapEntry restMapEntry = this.objectFactory.createMapEntry();
    restMapEntry.setKey(key);
    try {
        restMapEntry.setValue(this.jaxbConverter.serializeAny(value));
    } catch (ParserConfigurationException e) {
        throw new XWikiRestException("Failed to serialize property [" + key + "] with value [" + value + "]", e);
    }
    return restMapEntry;
}
Also used : MapEntry(org.xwiki.rest.model.jaxb.MapEntry) XWikiRestException(org.xwiki.rest.XWikiRestException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Example 2 with MapEntry

use of org.xwiki.rest.model.jaxb.MapEntry in project xwiki-platform by xwiki.

the class ModelFactory method toJobRequest.

public DefaultRequest toJobRequest(JobRequest restJobRequest) {
    DefaultRequest request = new DefaultRequest();
    if (restJobRequest.getId() != null) {
        request.setId(restJobRequest.getId().getElements());
    }
    request.setInteractive(restJobRequest.isInteractive());
    request.setVerbose(restJobRequest.isVerbose());
    request.setStatusSerialized(restJobRequest.isStatusSerialized());
    request.setStatusLogIsolated(restJobRequest.isStatusLogIsolated());
    for (MapEntry restEntry : restJobRequest.getProperties()) {
        request.setProperty(restEntry.getKey(), this.jaxbConverter.unserializeAny(restEntry.getValue()));
    }
    return request;
}
Also used : MapEntry(org.xwiki.rest.model.jaxb.MapEntry) DefaultRequest(org.xwiki.job.DefaultRequest)

Aggregations

MapEntry (org.xwiki.rest.model.jaxb.MapEntry)2 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 DefaultRequest (org.xwiki.job.DefaultRequest)1 XWikiRestException (org.xwiki.rest.XWikiRestException)1