How to remove a property of a CQ node in JAVA - aem

how can I remove the property of a node in JAVA code?
I have tried something like -
node.setProperty(propertyName, null);
Is there something specific which I can try?

Supposing that you have a typo with your "setProperty" method, you may be getting ambigous method error. You should do type casting if so:
node.setProperty(propertyName, (Value)null);
or use remove method
node.getProperty(propertyName).remove();
session.save();

you are missing
session.save();

Related

Add entity to the context without knowing the type

Is it possible to add a POCO entity to the object context without knowing the type?
For example, here I'm adding an employee...
context.Employ.Attach(employer);
Is it possible to do something like this...
context.Attach(employer);
This works...
context.Set(entity.GetType()).Attach(entity);
You may be able to use the Set property of your context. For example:
var entityType = employer.GetType();
context.Set(entityType).Attach(employer);

Overriding Zuul Filter SendErrorFilter

The class org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter handles error responses.
I would like to override this filter to do a custom response instead of the ZuulException while forwarding etc.
How can I replace this with my own version?
Just write and register? Would that do it or is there something else needed?
property name is changed to "zuul.SendErrorFilter.error.disable"
all you need to do is create a ZuulFilter and expose it as an #Bean. It needs to be in order before SendErrorFilter which is set to 0. You might need to remove "error.status_code" from the RequestContext so SendErrorFilter doesn't run.
You will need to disable a default SendErrorFilter by adding zuul.SendErrorFilter.post.disable: true to your application.properties. After this you can create your own.

Add outargument from activity to a Dictionary via Expression Editor

I want to add the outcome of my activity (using the expression editor) to an existing dictionary which is a workflow variable so something like..
dictionary.Add("key", this)
Or am I missing something here? Cheers
If I understood correctly I think I can help you.
Add it like that:
New Dictionary(Of String, String) From {{"MyParam", "ItsValue"}}
I've found it here:
http://social.msdn.microsoft.com/Forums/en/wfprerelease/thread/02eb6512-e6db-44ec-a8ca-8126dea3a8a4

Using Eclipse's JDT, how does one get an IType from a class name?

Is there a simple, straightforward way to get an IType from a class name? I think there must be some static method somewhere. Basically, I'd like to do something like:
IType objectType = Somewhere.getType("java.lang.Object")
Does anybody know of something like this? I have been searching in vain.
Given an IProject, one can use the IJavaProject#findType methods, e.g.
IType objectType = project.findType("java.lang.Object");
Look at org.eclipse.jdt.core.search.SearchEngine. I haven't tried it myself, I'm usually using the ASTParser with the Resolve option on (that's when you parse a source), but it should do the trick.

Get Specific Value from entity.OriginalValues in EFv4

I have an ObjectStateEntry "entry". I need to get a property value from this "entry" like so, but I don't know how to specify the property I want. I use entry.OriginalValues(propName) but then what?
As far as I understand you can try something like this:
entry.CurrentValues.Item[propName];
or
entry.CurrentValues.GetValue(entry.CurrentValues.GetOrdinal(propName))