Excluding fields in Dozer mapping - mapping

Is there a way to exclude multiple fields in Dozer, when source and target classes are the same?
I am using it like this:
<mapping map-null="false" wildcard="true">
<class-a>com.abc</class-a>
<class-b>com.abc</class-b>
<field-exclude>
<a>field1</a>
<b>field1</b>
</field-exclude>
<field-exclude>
<a>field2</a>
<b>field2</b>
</field-exclude> ....
</mapping>
It seems so funny to write same name when it's known that it'll always be same for all... Is there any alternative?

I found this post in Google, but I configure Dozer via annotations so the existing answer didn't help me.
In order to exclude a field from mapping via annotations use
#Mapping("this") on the field.
Source: Dozer, how to ignore a field with annotation

wildcard="false"
will do the trick.
http://dozer.sourceforge.net/documentation/exclude.html

Related

Add types in the parameter table when generating document with Stardoc

We are trying to use Stardoc when generating documentation for our Bazel macros.
I can get a table generated with parameter descriptions when follow the instruction here:
Macro/Function documenatation.
But we would also like to add the parameter Type in the table.
According to DocstringUtils.java it seems like we shall write the type in parentheses after the parameter name but before colon, as this example:
another_parameter (unused, mutable): a parameter may be followed
by additional attributes in parenthese
I have seen that it's possible to add a rule template to the stardoc() rule (attribute: func_template).
I started to use an own copy of the default template to play around with: //stardoc:templates/markdown_tables/func.vm
If I have understood correctly it doesn't seem that the attributes that I add in paranthese is fetched.
And I don't think that I will be able to retreive that information by just updating the template.
So I think that it will need an update in the Stardoc code for this, correct?!
Is that something that is already planned?
If I'm not correct then I would appreciate information how I can retreive the value of the attribute.
Thanks!
Best Regards
Elisabeth

xpages reader field with - read only type

I have question:
My xpages contain a field that contain creator of document.
The issue is:
When ReadOnly field is Enabled, the agent can't get value of the field from context.
I want user can't change the value of the field
How to solve it?
Note: there a button that will call the agent to process the context
Thank you for your help
Why not to use the disable property of the inputText? And with a little help of CSS the result might be just fine:
<xp:inputText id="inputText1"
style="background-color:none;border:none;background: transparent"
disabled="true">
....
</xp:inputText>
Or you can compute the disable property:
<xp:this.disabled><![CDATA[#{javascript:if (currentDocument.isEditable())
return true;}]]></xp:this.disabled>
Hint: I recommend to create a .css file and write there all the properties. Then just import the file to the respective xpage/custom control and specify the class in the Style property of the field.
First of all: it isn't very clear what you want to do. You have a field with the creator of a document and you speak of an agent. A few pointers:
Never try to process UI elements. Always go after the data model, the bound data.
Displaying a username doesn't write it back anywhere, you need to take a different action. Add to the "post new document" event something like:
var creator = document1.replaceItemValue("Creator",#UserName);
creator.setAuthors(true);
(above is off my head, might contain typos). Then the value is in the document, you can use it in a computed field and hand it over to an agent (which I wouldn't do, convert your agent code to Java and clean it up while you are on it).
Do you mean something like this?
<xp:inputText id="inputText1" defaultValue="test">
<xp:this.attrs>
<xp:attr name="readonly" value="true"></xp:attr>
</xp:this.attrs>
</xp:inputText>

Zend 2 - Default InArray Validator of Select Element gets lost

I have an issue when adding a filter to my select elements in Zend 2.2. When creating a select element, a default validator is added to this element:
This element adds an InArray validator to its input filter specification in order to validate on the server if the selected value belongs to the values.
This works fine until I add a custom filter to that element:
$filter = new Input('element_name');
$filter->setRequired(true);
$this->add($filter);
This Zend\InputFilter\Input is added to a Zend\InputFilter\InputFilter which is later added to my form. From now on the default validator is lost.
How can I add a filter to form elements without losing their default validators?
Am I missing something? I don't expect this as the default behaviour, because everyone is desperately asking how to deactivate it. There's even an attribute to deactivate it ('disable_inarray_validator'), however, I want to keep that validator without passing all my entries of the selectbox to my InputFilter. Also I didn't find anything in the Zend 2 documentation. I guess the solution must be something simple. Thanks in advance.
Note: Same happens when I add the InputFilter with the InputFilterManager to the form.
Please see my comment on your question first. Only thing I thought might work that I haven't tried to get this to work is:
$input->getFilterChain()
->attachByName('stringtrim')
or
$input->getFilterChain()
->attach(new StringTrim())

Setting up Umbraco Indexes

I've created a site using Umbraco 6.02, and I'm going over all the final configuration of the site now, and I've come to indexes. I've done some research, but I just cant find in simple terms what I need to include in each section and why.
Which fields I should include in the <IndexUserFields> section of the index? Is it just the fields I'll be using to search with, for example:currentNode.Children(x => x.bodyText.Contains("*"))? Or fields that I'll be using to sort nodes such as a date field for news articles? Or is there more to it than that?
Which document types do I need to put in the <IncludeNodeTypes> section and the <ExcludeNodeTypes> section and why?
And do I add my fields to one of the already created indexes, or do I create my own?
Old post but may help someone along the way.
http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx
You can create custom indexes (if you desire) to lock down what types of searching you're doing. Many times you have a search box somewhere on your page and you only want to search certain doc types and their related content.
Keep in mind that you can create NEW index sets, but remember that you'll need to register them in the Config/ExamineSettings.config file as well as the Config/ExamineIndex.config file.
The link above is how I got mine to work correctly for just searching (2) different doc types (which Examine uses as NodeTypes) in the config.
The settings below were created using the already default ExternalIndexer, not a newly created custom one.
The file that you want to edit is in Config/ExamineIndex.config. The set that you want to edit is the ExternalIndexSet (by default). The path will point to the external temp folder
<IndexSet SetName="ExternalIndexSet" IndexPath="~/App_Data/TEMP/ExamineIndexes/External/">
For fields, that goes in the IndexUserFields section, which are custom properties that you have defined on your doc types
<IndexUserFields>
<add Name="itemNumber" /> <-- custom property
<add Name="productName" /> <-- custom property
</IndexUserFields>
The doc types (NodeTypes) that you want are whatever you named your document types. Remember that these are the alias, not the name
<IncludeNodeTypes>
<add Name="Product" /> <-- document type
<add Name="Variant" /> <-- document type
</IncludeNodeTypes>
Remember after setting this up you want to re-index your Examine. You can get to this by logging into the backend of Umbraco and going to Developer, then clicking on the tab that says Examine Management.
Please note that the interface is Umbraco 7 but the config file will still be applicable for v6.

venue_new "address" parameter, or "adress"?

Is the parameter spelled "adress" or "address"?
Here's the API doc: http://developer.eventbrite.com/doc/venues/venue_new/
Where it says:
address The venue adress (line 1).
I ask this question because I'm porting some code, and it looks like we have been using "adress" and from looking at various github repos, it looks like this is considered one of the "inconsistant" variable naming issues related to this API.
I know the misspelled parameter is working.
I want to use the API correctly if I can, and would like to use "address" and just want confirmation that the it will indeed work, and that "adress" only works to be backwards compatible.
Thanks in advance!
Great question!
I fixed the 'adress' spelling typo, but the older spelling of this input label is still allowed (in order to ensure backwords compatibility with existing apps).
We don't have any plans to drop support for the older, misspelled attribute name - but, if you are revisiting old code, it won't hurt to fix the typo on your end as well.
The change should help ensure that the venue object's schema / attribute names remain consistent on input and output.

Resources