How to create an enum with multiple fields? - jhipster

Is it possible to create an enum with multiple fields with JDL?
See https://howtodoinjava.com/java/enum/enum-with-multiple-values/
Cheers

Related

One-to-many enum data type?

I need to implement an entity class with an attribute of a collection of enum data. I can't find any related JDL document on the subject. Is it something doable with JDL or do I need to change the generated code as the following afterward?
#ElementCollection(targetClass = MyEnum.class)
#CollectionTable
#Enumerated(EnumType.STRING)
Collection<MyEnum> myEnums;

Is it possible to return hjmpTS, aCLTS, propTS fields using Flexible Search in hybris?

I'm beginner in hybris and I noticed that the queries using select * from {itemType} returns the following fields named hjmpts, aCLTS and propTS. But when I use select {hjmpts}, {aCLTS}, {propTS} from {itemType} the hybris returns that these fields don't exist.
Does someone know if it is possible to create a Flexible Search to return hjmpts, aCLTS and propTS fields?
This one works in HAC:
SELECT hjmpts, aclts, propTS FROM {Employee}
These attributes are not Type attributes. If you look at the Type's attributes in Backoffice, you won't see them. This might be why you don't need to include the curly braces.
It's also possible to mix it with Type attributes:
SELECT hjmpts, aclts, propTS, {uid} FROM {Employee}

Difference between <enumtype> and <enum class=""> generation

What is the difference between creating an enum with <enumtype> in items.xml and generating it with <enum class="..."/> ?
Is the <enum> generated class not saved in DB? and acts only as a DTO?
enumtype instances are Hybris enums, whose values are saved in the database. They can be dynamic or static, and their values can be searched in Backoffice.
enum instances are plain Java enums, whose values are defined in XML. You can't add new values for them via Backoffice (assuming they are dynamic).

How to Create Unique Constraint with Multiple Columns using ServiceStack.OrmLite?

How does one create a unique constraint with ServiceStack.OrmLite (using attributes, hopefully)? The documentation shows how to create a unique constraint only on a single column:
ServiceStack.OrmLite Docs
If it helps, I am using ServiceStack.OrmLite.SqlServer.
Service Stack appears to have a CompositeIndex attribute which takes multiple field names. Here's a look at the constructors...
CompositeIndexAttribute(params string[] fieldNames);
CompositeIndexAttribute(bool unique, params string[] fieldNames);

How do I set a friendly name for SharePoint custom property enums?

I have a simple web part with a custom enum property (which SharePoint renders for me as a dropdown).
Is there a way to render friendly names for the enum values?
I have tried System.ComponentModel.DescriptionAttribute, but it does not seem to work. I also tried Microsoft.SharePoint.WebPartPages.FriendlyNameAttribute, but it cannot be applied to enum values.
I assume you're using the ToolPart; why not just wire up your own dropdown instead of letting sharepoint bind the enum for you?

Resources