Tabnine Logo
MenuItemDescription
Code IndexAdd Tabnine to your IDE (free)

How to use
MenuItemDescription
in
org.jbpm.form.builder.services.model.menu

Best Java code snippets using org.jbpm.form.builder.services.model.menu.MenuItemDescription (Showing top 10 results out of 315)

origin: org.jbpm/jbpm-form-services

@Override
@SuppressWarnings("unchecked")
public Map<String, List<MenuItemDescription>> decodeMenuItemsMap(String json)
    throws FormEncodingException {
  JsonObject jsonObj = new JsonParser().parse(json).getAsJsonObject();
  Map<String, Object> dataMap = asMap(jsonObj);
  Map<String, List<MenuItemDescription>> retval = null;
  if (dataMap != null) {
    retval = new HashMap<String, List<MenuItemDescription>>();
    for (Map.Entry<String, Object> entry : dataMap.entrySet()) {
      List<MenuItemDescription> itemsList = new ArrayList<MenuItemDescription>();
      String key = entry.getKey();
      Object obj = entry.getValue();
      if (obj != null) {
        List<Object> itemsMapList = (List<Object>) obj;
        for (Object itemObj : itemsMapList) {
          Map<String, Object> itemDescMap = (Map<String, Object>) itemObj;
          MenuItemDescription desc = new MenuItemDescription();
          desc.setDataMap(itemDescMap);
          itemsList.add(desc);
        }
      }
      retval.put(key, itemsList);
    }
  }
  return retval;
}
origin: org.jbpm/form-services

@Override
public String encodeMenuItemsMap(Map<String, List<MenuItemDescription>> items) throws FormEncodingException {
  Map<String, Object> dataMap = new HashMap<String, Object>();
  if (items == null) {
    return "null";
  }
  for (Map.Entry<String, List<MenuItemDescription>> entry : items.entrySet()) {
    List<Map<String, Object>> itemMap = new ArrayList<Map<String, Object>>();
    for (MenuItemDescription desc : entry.getValue()) {
      itemMap.add(desc.getDataMap());
    }
    dataMap.put(entry.getKey(), itemMap);
  }
  return jsonFromMap(dataMap);
}

origin: org.jbpm/form-services

protected void removeFromMap(String groupName, MenuItemDescription item, Map<String, List<MenuItemDescription>> items) {
  String group = groupName == null ? "Custom" : groupName;
  List<MenuItemDescription> customItems = items.get(group);
  if (customItems == null) {
    customItems = new ArrayList<MenuItemDescription>();
  }
  MenuItemDescription serverItem = null;
  for (MenuItemDescription subItem : customItems) {
    if (subItem.getName().equals(item.getName())) {
      serverItem = subItem;
      break;
    }
  }
  customItems.remove(serverItem);
  if (customItems.isEmpty()) {
    items.remove(group);
  } else {
    items.put(group, customItems);
  }
}
origin: org.jbpm/jbpm-form-services

private void abstractTestSaveMenuItemProblem(final Class<?> exceptionType) throws Exception {
  FSMenuService service = createMockedService(exceptionType);
  MenuItemDescription sampleDescription = new MenuItemDescription();
  sampleDescription.setAllowedEvents(new ArrayList<String>());
  sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
  FormItemRepresentation item = MockFormHelper.createMockForm("form", "param1").getFormItems().iterator().next();
  sampleDescription.setItemRepresentationMap(item.getDataMap());
  sampleDescription.setIconUrl("https://www.google.com/images/srpr/logo3w.png");
  sampleDescription.setName("name");
  try {
    service.saveMenuItem("group", sampleDescription);
    fail("saveMenuItem shouldn't succeed");
  } catch (MenuServiceException e) {
    assertNotNull("e shouldn't be null", e);
    Throwable cause = e.getCause();
    assertNotNull("cause shouldn't be null", cause);
    assertTrue("cause should be a " + exceptionType.getName(), cause.getClass().equals(exceptionType));
  }
}
@Test
origin: org.jbpm/form-services

private void abstractTestSaveMenuItemProblem(final Class<?> exceptionType) throws Exception {
  FSMenuService service = createMockedService(exceptionType);
  MenuItemDescription sampleDescription = new MenuItemDescription();
  sampleDescription.setAllowedEvents(new ArrayList<String>());
  sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
  FormItemRepresentation item = MockFormHelper.createMockForm("form", "param1").getFormItems().iterator().next();
  sampleDescription.setItemRepresentationMap(item.getDataMap());
  sampleDescription.setIconUrl("https://www.google.com/images/srpr/logo3w.png");
  sampleDescription.setName("name");
  try {
    service.saveMenuItem("group", sampleDescription);
    fail("saveMenuItem shouldn't succeed");
  } catch (MenuServiceException e) {
    assertNotNull("e shouldn't be null", e);
    Throwable cause = e.getCause();
    assertNotNull("cause shouldn't be null", cause);
    assertTrue("cause should be a " + exceptionType.getName(), cause.getClass().equals(exceptionType));
  }
}
@Test
origin: org.jbpm/jbpm-form-services

  @Test
  public void testSaveMenuItemEncodingProblem() throws Exception {
    FSMenuService service = createMockedService(null);
    MenuItemDescription sampleDescription = new MenuItemDescription();
    sampleDescription.setAllowedEvents(new ArrayList<String>());
    sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
    FormItemRepresentation item = MockFormHelper.createMockForm("form", "param1").getFormItems().iterator().next();
    sampleDescription.setItemRepresentationMap(item.getDataMap());
    sampleDescription.setName("name");
    FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
    FormEncodingException exception = new FormEncodingException();
    @SuppressWarnings("unchecked")
    Map<String, List<MenuItemDescription>> anyObject = EasyMock.anyObject(Map.class);
    EasyMock.expect(encoder.encodeMenuItemsMap(anyObject)).andThrow(exception).once();
    FormEncodingFactory.register(encoder, FormEncodingFactory.getDecoder());
    
    EasyMock.replay(encoder);
    try {
      service.saveMenuItem("group", sampleDescription);
      fail("saveMenuItem shouldn't succeed");
    } catch (MenuServiceException e) {
      assertNotNull("e shouldn't be null", e);
      Throwable cause = e.getCause();
      assertNotNull("cause shouldn't be null", cause);
      assertTrue("cause should be a FormEncodingException", cause instanceof FormEncodingException);
    }
    EasyMock.verify(encoder);
  }
// THIS TEST REQUIRES THE REAL GWT Components so it should be executed in the showcase    
origin: org.jbpm/form-services

@Override
@SuppressWarnings("unchecked")
public Map<String, List<MenuItemDescription>> decodeMenuItemsMap(String json)
    throws FormEncodingException {
  JsonObject jsonObj = new JsonParser().parse(json).getAsJsonObject();
  Map<String, Object> dataMap = asMap(jsonObj);
  Map<String, List<MenuItemDescription>> retval = null;
  if (dataMap != null) {
    retval = new HashMap<String, List<MenuItemDescription>>();
    for (Map.Entry<String, Object> entry : dataMap.entrySet()) {
      List<MenuItemDescription> itemsList = new ArrayList<MenuItemDescription>();
      String key = entry.getKey();
      Object obj = entry.getValue();
      if (obj != null) {
        List<Object> itemsMapList = (List<Object>) obj;
        for (Object itemObj : itemsMapList) {
          Map<String, Object> itemDescMap = (Map<String, Object>) itemObj;
          MenuItemDescription desc = new MenuItemDescription();
          desc.setDataMap(itemDescMap);
          itemsList.add(desc);
        }
      }
      retval.put(key, itemsList);
    }
  }
  return retval;
}
origin: org.jbpm/jbpm-form-services

@Override
public String encodeMenuItemsMap(Map<String, List<MenuItemDescription>> items) throws FormEncodingException {
  Map<String, Object> dataMap = new HashMap<String, Object>();
  if (items == null) {
    return "null";
  }
  for (Map.Entry<String, List<MenuItemDescription>> entry : items.entrySet()) {
    List<Map<String, Object>> itemMap = new ArrayList<Map<String, Object>>();
    for (MenuItemDescription desc : entry.getValue()) {
      itemMap.add(desc.getDataMap());
    }
    dataMap.put(entry.getKey(), itemMap);
  }
  return jsonFromMap(dataMap);
}

origin: org.jbpm/jbpm-form-services

protected void removeFromMap(String groupName, MenuItemDescription item, Map<String, List<MenuItemDescription>> items) {
  String group = groupName == null ? "Custom" : groupName;
  List<MenuItemDescription> customItems = items.get(group);
  if (customItems == null) {
    customItems = new ArrayList<MenuItemDescription>();
  }
  MenuItemDescription serverItem = null;
  for (MenuItemDescription subItem : customItems) {
    if (subItem.getName().equals(item.getName())) {
      serverItem = subItem;
      break;
    }
  }
  customItems.remove(serverItem);
  if (customItems.isEmpty()) {
    items.remove(group);
  } else {
    items.put(group, customItems);
  }
}
origin: org.jbpm/form-services

  @Test
  public void testSaveMenuItemEncodingProblem() throws Exception {
    FSMenuService service = createMockedService(null);
    MenuItemDescription sampleDescription = new MenuItemDescription();
    sampleDescription.setAllowedEvents(new ArrayList<String>());
    sampleDescription.setEffects(new ArrayList<FormEffectDescription>());
    FormItemRepresentation item = MockFormHelper.createMockForm("form", "param1").getFormItems().iterator().next();
    sampleDescription.setItemRepresentationMap(item.getDataMap());
    sampleDescription.setName("name");
    FormRepresentationEncoder encoder = EasyMock.createMock(FormRepresentationEncoder.class);
    FormEncodingException exception = new FormEncodingException();
    @SuppressWarnings("unchecked")
    Map<String, List<MenuItemDescription>> anyObject = EasyMock.anyObject(Map.class);
    EasyMock.expect(encoder.encodeMenuItemsMap(anyObject)).andThrow(exception).once();
    FormEncodingFactory.register(encoder, FormEncodingFactory.getDecoder());
    
    EasyMock.replay(encoder);
    try {
      service.saveMenuItem("group", sampleDescription);
      fail("saveMenuItem shouldn't succeed");
    } catch (MenuServiceException e) {
      assertNotNull("e shouldn't be null", e);
      Throwable cause = e.getCause();
      assertNotNull("cause shouldn't be null", cause);
      assertTrue("cause should be a FormEncodingException", cause instanceof FormEncodingException);
    }
    EasyMock.verify(encoder);
  }
// THIS TEST REQUIRES THE REAL GWT Components so it should be executed in the showcase    
org.jbpm.form.builder.services.model.menuMenuItemDescription

Most used methods

  • <init>
  • getDataMap
  • getName
  • setAllowedEvents
  • setDataMap
  • setEffects
  • setIconUrl
  • setItemRepresentationMap
  • setName

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • JPanel (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now