Java API to unset / delete line number (value of the attribute) of a part-usage?
Hi All,
some time ago I made a customization which automatically writes the values we want to the OOTB line number attribute in wtparts at check-in, using a listener.
But as it turns out, reality is always more complex than the plan you have and your users say they want...
As of now, I found no way to ‘unset’ (aka delete) an existing line number. That sounds strange, but maybe I am just not proficient enough to read and interpret the javadoc ...🙈
The use case could be coined like this: ‘set the line number attribute of part usage id-xy (which, by the way, now has the value ‘123’) to an ‘empty’ value.‘
So, right now the tool is writing the line number like this to the attribute:
long NewlineNumber = 123;
LineNumber TheNewlineNumber = new LineNumber();
TheNewlineNumber.setValue(NewlineNumber);
usagelink.setLineNumber(TheNewlineNumber);
PersistenceServerHelper.update(usagelink);We have left the attribute with the OOTB constraints, so it should be possible to have an empty value:
This works via the user interface in the browser.
Using the API, simply writing an empty string doesn’t work, and writing null also got me to an error…
(trying to write 0 also didn’t work, although I read in the API docs properties=@GeneratedProperty(name="value",type=long.class,supportedAPI=PUBLIC,constraints=@PropertyConstraints(lowerLimit=0))) regarding the LineNumber class.)
Did I overlook something, maybe there is even a more generic way to achieve this?
greetings

