leitstand-inventory-model/src/main/java/io/leitstand/inventory/rs/ElementSettingsResource.java
@POST
	public Response storeElementSettings(@Valid ElementSettings settings){
        try {
            if(service.storeElementSettings(settings)){
                return created(messages,"/elements/%s/settings",settings.getElementId());
            }
            return success(messages);
        } catch (Exception e) {
            givenRollbackException(e)
            .whenEntityExists(() -> service.getElementSettings(settings.getElementName()))
            .thenThrow( new UniqueKeyConstraintViolationException(IVT0307E_ELEMENT_NAME_ALREADY_IN_USE,
                                                                  key("element_name", settings.getElementName())));
            throw e;
        }
	}
/**
	 * Adds a new element or updates an existing element.
	 * @param settings the element settings
	 * @return a created response if a new element was created, a success response if the settings of an existing element have been updated
	 */
Adds a new element or updates an existing element.
@param settings the element settings
@return a created response if a new element was created, a success response if the settings of an existing element have been updated
Adds a new element or updates an existing element . @param settings the element settings @return a created response if a new element was created a success response if the settings of an existing element have been updated
@POST
	public Response storeElementSettings(@Valid ElementSettings settings){
        try {
            if(service.storeElementSettings(settings)){
                return created(messages,"/elements/%s/settings",settings.getElementId());
            }
            return success(messages);
        } catch (Exception e) {
            givenRollbackException(e)
            .whenEntityExists(() -> service.getElementSettings(settings.getElementName()))
            .thenThrow( new UniqueKeyConstraintViolationException(IVT0307E_ELEMENT_NAME_ALREADY_IN_USE,
                                                                  key("element_name", settings.getElementName())));
            throw e;
        }
	}
@ POST public Response storeElementSettings ( @ Valid ElementSettings settings ) { try { if ( service . storeElementSettings ( settings ) ) { return created ( messages , "/elements/%s/settings" , settings . getElementId ( ) ) ; } return success ( messages ) ; } catch ( Exception e ) { givenRollbackException ( e ) . whenEntityExists ( ( ) -> service . getElementSettings ( settings . getElementName ( ) ) ) . thenThrow ( new UniqueKeyConstraintViolationException ( IVT0307E_ELEMENT_NAME_ALREADY_IN_USE , key ( "element_name" , settings . getElementName ( ) ) ) ) ; throw e ; } }
Adds a new element or updates an existing element.
Adds a new element or updates an existing element .