use of com.haulmont.cuba.core.entity.BaseUuidEntity in project cuba by cuba-platform.
the class UserSetHelper method removeIds.
public static String removeIds(Set<String> current, Collection entities) {
Set<String> convertedSet = new HashSet<>();
for (Object entity : entities) {
convertedSet.add(((BaseUuidEntity) entity).getId().toString());
}
current.removeAll(convertedSet);
if (current.isEmpty()) {
return "NULL";
}
StringBuilder listOfId = new StringBuilder();
Iterator it = current.iterator();
while (it.hasNext()) {
listOfId.append(it.next());
if (it.hasNext()) {
listOfId.append(',');
}
}
return listOfId.toString();
}
use of com.haulmont.cuba.core.entity.BaseUuidEntity in project cuba by cuba-platform.
the class UserSetHelper method createIdsString.
public static String createIdsString(Set<String> current, Collection entities) {
Set<String> convertedSet = new HashSet<>();
for (Object entity : entities) {
convertedSet.add(((BaseUuidEntity) entity).getId().toString());
}
current.addAll(convertedSet);
if (current.isEmpty()) {
return "NULL";
}
StringBuilder listOfId = new StringBuilder();
Iterator it = current.iterator();
while (it.hasNext()) {
listOfId.append(it.next());
if (it.hasNext()) {
listOfId.append(',');
}
}
return listOfId.toString();
}
use of com.haulmont.cuba.core.entity.BaseUuidEntity in project cuba by cuba-platform.
the class WebLookupField method initNullEntity.
protected void initNullEntity() {
// noinspection IncorrectCreateEntity
nullEntity = new BaseUuidEntity() {
@Override
public String getInstanceName() {
if (nullOption instanceof Instance) {
return InstanceUtils.getInstanceName((Instance) nullOption);
}
if (nullOption == null) {
return "";
} else {
return nullOption.toString();
}
}
// Used for captionProperty of null entity
@Override
public <T> T getValue(String s) {
return (T) getInstanceName();
}
};
component.setNullSelectionItemId(nullEntity);
}
Aggregations