use of com.emc.vipr.model.catalog.Option in project coprhd-controller by CoprHD.
the class ServiceDescriptorMapper method map.
public static ServiceFieldRestRep map(ServiceField from) {
if (from == null) {
return null;
}
ServiceFieldRestRep to = new ServiceFieldRestRep();
mapServiceItemCommon(to, from);
to.setFailureMessage(from.getValidation().getError());
to.setInitialValue(from.getInitialValue());
to.setLockable(from.isLockable());
to.setMax(from.getValidation().getMax());
to.setMin(from.getValidation().getMin());
to.setRegEx(from.getValidation().getRegEx());
to.setRequired(from.isRequired());
to.setOmitNone(from.isOmitNone());
to.setModalField(from.isModalField());
to.setSelect(from.getSelect());
to.setHideIfEmpty(from.getHideIfEmpty());
for (String key : from.getOptions().keySet()) {
to.getOptions().add(new Option(key, from.getOptions().get(key)));
}
return to;
}
use of com.emc.vipr.model.catalog.Option in project coprhd-controller by CoprHD.
the class EditCatalog method loadImageOptions.
private static List<Option> loadImageOptions() {
VirtualFile imageDir = Play.getVirtualFile("public/img/serviceCatalog");
List<Option> images = Lists.newArrayList();
for (VirtualFile f : imageDir.list()) {
String label = f.getName().replaceAll("(icon_|.png)", "");
images.add(new Option(f.getName(), label));
}
for (CatalogImageRestRep image : CatalogImageUtils.getCatalogImages()) {
String filename = StringUtils.substringBeforeLast(image.getName(), ".");
images.add(new Option(image.getId().toString(), filename));
}
Collections.sort(images, new BeanComparator("value", new StringComparator(false)));
return images;
}
Aggregations