@Override
    @Path("/{ownerType}/{ownerId}")
    @ApiOperation(value="Update values for an ownerType and ownerId", response=StatusMessage.class)
    @ApiImplicitParams({
        @ApiImplicitParam(name="Values", paramType="body")})
    public JSONObject put(String path, JSONObject content, Map<String,String> headers)
    throws ServiceException, JSONException {
        Map<String,String> parameters = getParameters(headers);
        String ownerType = getSegment(path, 1);
        if (ownerType == null)
            ownerType = parameters.get("ownerType");
        if (ownerType == null)
            throw new ServiceException("Missing parameter: ownerType");
        String ownerId = getSegment(path, 2);
        if (ownerId == null)
            ownerId = parameters.get("ownerId");
        if (ownerId == null)
            throw new ServiceException("Missing parameter: ownerId");
        String updateOnly = getSegment(path, 3);
        if (updateOnly == null)
            updateOnly = parameters.get("updateOnly");
        if (content == null)
            throw new ServiceException("Missing JSON object: attributes");

        try {
            Map<String,String> values = new HashMap<String,String>();
            String[] names = JSONObject.getNames(content);
            if (names != null) {
                for (String name : names)
                    values.put(name, content.getString(name));
            }
            WorkflowServices workflowServices = ServiceLocator.getWorkflowServices();

            if (updateOnly != null) {
                // update values, without deleting all other values for that ownerId
                workflowServices.updateValues(ownerType, ownerId, values);
            } else {
                workflowServices.setValues(ownerType, ownerId, values);
            }
            return null;
        }
        catch (JSONException ex) {
            throw new ServiceException(ex.getMessage(), ex);
        }
    }
@ Override @ Path ( "/{ownerType}/{ownerId}" ) @ ApiOperation ( value = "Update values for an ownerType and ownerId" , response = StatusMessage . class ) @ ApiImplicitParams ( { @ ApiImplicitParam ( name = "Values" , paramType = "body" ) } ) public JSONObject put ( String path , JSONObject content , Map < String , String > headers ) throws ServiceException , JSONException { Map < String , String > parameters = getParameters ( headers ) ; String ownerType = getSegment ( path , 1 ) ; if ( ownerType == null ) ownerType = parameters . get ( "ownerType" ) ; if ( ownerType == null ) throw new ServiceException ( "Missing parameter: ownerType" ) ; String ownerId = getSegment ( path , 2 ) ; if ( ownerId == null ) ownerId = parameters . get ( "ownerId" ) ; if ( ownerId == null ) throw new ServiceException ( "Missing parameter: ownerId" ) ; String updateOnly = getSegment ( path , 3 ) ; if ( updateOnly == null ) updateOnly = parameters . get ( "updateOnly" ) ; if ( content == null ) throw new ServiceException ( "Missing JSON object: attributes" ) ; try { Map < String , String > values = new HashMap < String , String > ( ) ; String [ ] names = JSONObject . getNames ( content ) ; if ( names != null ) { for ( String name : names ) values . put ( name , content . getString ( name ) ) ; } WorkflowServices workflowServices = ServiceLocator . getWorkflowServices ( ) ; if ( updateOnly != null ) { workflowServices . updateValues ( ownerType , ownerId , values ) ; } else { workflowServices . setValues ( ownerType , ownerId , values ) ; } return null ; } catch ( JSONException ex ) { throw new ServiceException ( ex . getMessage ( ) , ex ) ; } }
Update values for owner type and id.
Existing values are always overwritten.