private static void setBoolProperty(String propertyName, Boolean value) {
   if (Boolean.TRUE.equals(value)) {
     administrationService.setGlobalProperty(propertyName, Boolean.TRUE.toString());
   } else {
     administrationService.setGlobalProperty(propertyName, Boolean.FALSE.toString());
   }
 }
Пример #2
0
  @Override
  public boolean load15Data(String data) {
    String[] items = data.split(IConnectionPoint15Constants.DELIMITER);

    if (items.length < 7) {
      return false;
    }

    setName(items[0]);
    setHost(items[1]);
    if (items[2] == null || "".equals(items[2])) { // $NON-NLS-1$
      setPath(Path.ROOT);
    } else {
      setPath(new Path(items[2]));
    }
    setLogin(items[3]);
    setPassword(items[4].toCharArray());
    setPassiveMode(items[5].equals(Boolean.TRUE.toString()));
    setId(items[6]);

    if (items.length >= 10) {
      setPort(Integer.parseInt(items[9]));
    }
    if (items.length >= 12) {
      setExplicit(items[11].equals(Boolean.TRUE.toString()));
    }
    return true;
  }
Пример #3
0
  protected static Map<String, String[]> addDefaultPublishingParameters(
      Map<String, String[]> parameterMap) {

    parameterMap.put(PortletDataHandlerKeys.DELETIONS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.IGNORE_LAST_PUBLISH_DATE, new String[] {Boolean.FALSE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.LAYOUT_SET_SETTINGS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.LOGO, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.PERMISSIONS, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_CONFIGURATION_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(PortletDataHandlerKeys.PORTLET_DATA, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_DATA_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        PortletDataHandlerKeys.PORTLET_SETUP_ALL, new String[] {Boolean.TRUE.toString()});
    parameterMap.put(
        ExportImportDateUtil.RANGE,
        new String[] {ExportImportDateUtil.RANGE_FROM_LAST_PUBLISH_DATE});
    parameterMap.put(
        PortletDataHandlerKeys.THEME_REFERENCE, new String[] {Boolean.TRUE.toString()});

    return parameterMap;
  }
Пример #4
0
 /*
  * (non-Javadoc)
  * @see com.draco.core.validator.Validator#isValid()
  */
 public boolean isValid(List<ValidatorResult> validatorResult) {
   if (validatorResult == null) return Boolean.TRUE.booleanValue();
   for (int i = 0; i < validatorResult.size(); i++) {
     if (!validatorResult.get(i).isValid()) return Boolean.FALSE.booleanValue();
   }
   return Boolean.TRUE.booleanValue();
 }
Пример #5
0
 private BuildActionExecuter<ProviderOperationParameters> createExecuter(
     ProviderOperationParameters operationParameters) {
   LoggingServiceRegistry loggingServices;
   Parameters params = initParams(operationParameters);
   BuildActionExecuter<BuildActionParameters> executer;
   if (Boolean.TRUE.equals(operationParameters.isEmbedded())) {
     loggingServices = this.loggingServices;
     executer = embeddedExecutor;
   } else {
     if (Boolean.TRUE.equals(operationParameters.isColorOutput())) {
       PrintStream outStr = new PrintStream(operationParameters.getStandardOutput());
       DefaultColorMap colourMap = new DefaultColorMap();
       colourMap.setUseColor(true);
       Console console = new AnsiConsole(outStr, outStr, colourMap, true);
       loggingServices = this.loggingServices.newColoredLogging(console);
     } else {
       loggingServices = this.loggingServices.newToolingApiLogging();
     }
     loggingServices
         .get(OutputEventRenderer.class)
         .configure(operationParameters.getBuildLogLevel());
     ServiceRegistry clientServices =
         daemonClientFactory.createBuildClientServices(
             loggingServices.get(OutputEventListener.class),
             params.daemonParams,
             operationParameters.getStandardInput(SafeStreams.emptyInput()));
     executer = clientServices.get(DaemonClient.class);
   }
   Factory<LoggingManagerInternal> loggingManagerFactory =
       loggingServices.getFactory(LoggingManagerInternal.class);
   return new LoggingBridgingBuildActionExecuter(
       new DaemonBuildActionExecuter(executer, params.daemonParams), loggingManagerFactory);
 }
  private void _initSassCompiler(String sassCompilerClassName) throws Exception {

    if (Validator.isNull(sassCompilerClassName) || sassCompilerClassName.equals("jni")) {

      try {
        System.setProperty("jna.nosys", Boolean.TRUE.toString());

        _sassCompiler = new JniSassCompiler();

        System.out.println("Using native Sass compiler");
      } catch (Throwable t) {
        System.out.println("Unable to load native compiler, falling back to Ruby");

        _sassCompiler = new RubySassCompiler();
      }
    } else {
      try {
        _sassCompiler = new RubySassCompiler();

        System.out.println("Using ruby Sass compiler");
      } catch (Exception e) {
        System.out.println("Unable to load Ruby compiler, falling back to native");

        System.setProperty("jna.nosys", Boolean.TRUE.toString());

        _sassCompiler = new JniSassCompiler();
      }
    }
  }
  private void maybeShowFor(Component c, MouseEvent me) {
    if (!(c instanceof JComponent)) return;

    JComponent comp = (JComponent) c;
    Window wnd = SwingUtilities.getWindowAncestor(comp);
    if (wnd == null) return;

    if (!wnd.isActive()) {
      if (JBPopupFactory.getInstance().isChildPopupFocused(wnd)) return;
    }

    String tooltipText = comp.getToolTipText(me);
    if (tooltipText == null || tooltipText.trim().isEmpty()) return;

    boolean centerDefault =
        Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_DEFAULT));
    boolean centerStrict =
        Boolean.TRUE.equals(comp.getClientProperty(UIUtil.CENTER_TOOLTIP_STRICT));
    int shift = centerStrict ? 0 : centerDefault ? 4 : 0;

    // Balloon may appear exactly above useful content, such behavior is rather annoying.
    if (c instanceof JTree) {
      TreePath path = ((JTree) c).getClosestPathForLocation(me.getX(), me.getY());
      if (path != null) {
        Rectangle pathBounds = ((JTree) c).getPathBounds(path);
        if (pathBounds != null && pathBounds.y + 4 < me.getY()) {
          shift += me.getY() - pathBounds.y - 4;
        }
      }
    }

    queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift);
  }
Пример #8
0
  /**
   * Called before window creation, descendants should override to initialize the data, initialize
   * params.
   */
  void preInit(XCreateWindowParams params) {
    state_lock = new StateLock();
    initialising = InitialiseState.NOT_INITIALISED;
    embedded = Boolean.TRUE.equals(params.get(EMBEDDED));
    visible = Boolean.TRUE.equals(params.get(VISIBLE));

    Object parent = params.get(PARENT);
    if (parent instanceof XBaseWindow) {
      parentWindow = (XBaseWindow) parent;
    } else {
      Long parentWindowID = (Long) params.get(PARENT_WINDOW);
      if (parentWindowID != null) {
        parentWindow = XToolkit.windowToXWindow(parentWindowID);
      }
    }

    Long eventMask = (Long) params.get(EVENT_MASK);
    if (eventMask != null) {
      long mask = eventMask.longValue();
      mask |= SubstructureNotifyMask;
      params.put(EVENT_MASK, mask);
    }

    screen = -1;
  }
Пример #9
0
 @Override
 public String getFirst(Map flags, String... keys) {
   for (String k : keys) {
     if (k != null && containsKey(k)) return (String) get(k);
   }
   if (flags.get("warnIfNone") != null && !Boolean.FALSE.equals(flags.get("warnIfNone"))) {
     if (Boolean.TRUE.equals(flags.get("warnIfNone")))
       LOG.warn("Unable to find Brooklyn property " + keys);
     else LOG.warn("" + flags.get("warnIfNone"));
   }
   if (flags.get("failIfNone") != null && !Boolean.FALSE.equals(flags.get("failIfNone"))) {
     Object f = flags.get("failIfNone");
     if (f instanceof Closure) ((Closure) f).call((Object[]) keys);
     if (Boolean.TRUE.equals(f))
       throw new NoSuchElementException(
           "Brooklyn unable to find mandatory property "
               + keys[0]
               + (keys.length > 1
                   ? " (or "
                       + (keys.length - 1)
                       + " other possible names, full list is "
                       + Arrays.asList(keys)
                       + ")"
                   : ""));
     else throw new NoSuchElementException("" + f);
   }
   if (flags.get("defaultIfNone") != null) {
     return (String) flags.get("defaultIfNone");
   }
   return null;
 }
  public void summaryRowSelection(final ReportEvent event) {
    if (rowbandingOnGroup == false) {
      return;
    }

    if (StringUtils.isEmpty(group)) {
      final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
      if (group instanceof CrosstabRowGroup) {
        final GroupBody body = group.getBody();
        if (body instanceof CrosstabColumnGroupBody) {
          if (Boolean.TRUE.equals(
              group.getAttribute(
                  AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
            triggerVisibleStateCrosstab(event);
          }
        }
      }
    } else {
      if (FunctionUtilities.isDefinedGroup(group, event)) {
        final Group group = event.getReport().getGroup(event.getState().getCurrentGroupIndex());
        if (Boolean.TRUE.equals(
            group.getAttribute(
                AttributeNames.Crosstab.NAMESPACE, AttributeNames.Crosstab.PRINT_SUMMARY))) {
          triggerVisibleStateCrosstab(event);
        }
      }
    }
  }
Пример #11
0
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   String mode = req.getParameter("mode");
   int status;
   if ("request".equals(mode)) {
     status =
         Boolean.TRUE.equals(req.getAttribute(BAT_ATTRIBUTE_NAME))
             ? HttpServletResponse.SC_OK
             : HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
   } else if ("sce".equals(mode)) {
     status =
         Boolean.TRUE.equals(req.getServletContext().getAttribute(BAT_ATTRIBUTE_NAME))
             ? HttpServletResponse.SC_OK
             : HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
   } else if ("session".equals(mode)) {
     status =
         Boolean.TRUE.equals(req.getSession().getAttribute(BAT_ATTRIBUTE_NAME))
             ? HttpServletResponse.SC_OK
             : HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
   } else {
     status = HttpServletResponse.SC_NOT_FOUND;
   }
   resp.setStatus(status);
 }
Пример #12
0
 private void writeState(final Element element) {
   JDOMExternalizerUtil.writeField(
       element, INSTRUMENTATION_TYPE_NAME, myInstrumentationType.toString());
   JDOMExternalizerUtil.writeField(element, LANGUAGE_ANNOTATION_NAME, myLanguageAnnotation);
   JDOMExternalizerUtil.writeField(element, PATTERN_ANNOTATION_NAME, myPatternAnnotation);
   JDOMExternalizerUtil.writeField(element, SUBST_ANNOTATION_NAME, mySubstAnnotation);
   if (myIncludeUncomputablesAsLiterals) {
     JDOMExternalizerUtil.writeField(element, INCLUDE_UNCOMPUTABLES_AS_LITERALS, "true");
   }
   if (mySourceModificationAllowed) {
     JDOMExternalizerUtil.writeField(element, SOURCE_MODIFICATION_ALLOWED, "true");
   }
   switch (myDfaOption) {
     case OFF:
       break;
     case RESOLVE:
       JDOMExternalizerUtil.writeField(element, RESOLVE_REFERENCES, Boolean.TRUE.toString());
       break;
     case ASSIGNMENTS:
       JDOMExternalizerUtil.writeField(
           element, LOOK_FOR_VAR_ASSIGNMENTS, Boolean.TRUE.toString());
       break;
     case DFA:
       JDOMExternalizerUtil.writeField(element, USE_DFA_IF_AVAILABLE, Boolean.TRUE.toString());
       break;
   }
 }
  @Test
  public void testEjbSessionBeans() throws IOException {
    JsonObject allBeans = getPageAsJSONObject(BEANS_PATH_ALL, url);
    JsonArray beansData = allBeans.getJsonArray(DATA);

    List<JsonObject> statefulEjbSessionList =
        getAllJsonObjectsByClass(StatefulEjbSession.class, beansData);
    assertEquals(statefulEjbSessionList.size(), 1);
    JsonObject statefulEjbJson = statefulEjbSessionList.get(0);
    String statefulEjbSessionId = statefulEjbJson.getString(ID);
    JsonObject sessionBeansDetail =
        getPageAsJSONObject(BEANS_PATH + "/" + statefulEjbSessionId, url);

    assertEquals(BeanType.SESSION.name(), sessionBeansDetail.getString(KIND));
    assertTrue(
        checkStringInArrayRecursively(
            DecoratedInterface.class.getName(),
            TYPES,
            sessionBeansDetail.getJsonArray(TYPES),
            false));
    assertEquals(Boolean.TRUE.booleanValue(), sessionBeansDetail.getBoolean(IS_ALTERNATIVE));
    assertEquals(Boolean.TRUE.booleanValue(), sessionBeansDetail.getBoolean(EJB_NAME));
    assertEquals(SessionBeanType.STATEFUL.name(), sessionBeansDetail.getString(SESSION_BEAN_TYPE));

    JsonObject sessionBeanEnablement = sessionBeansDetail.getJsonObject(ENABLEMENT);
    // TODO introduce enum with priority ranges
    assertEquals("APPLICATION", sessionBeanEnablement.getString(PRIORITY_RANGE));
    assertEquals(2500, sessionBeanEnablement.getInt(PRIORITY));
  }
Пример #14
0
    static String toString(
        Boolean preserveReplication,
        Boolean preserveBlockSize,
        Boolean preserveUser,
        Boolean preserveGroup,
        Boolean preservePermission) {

      StringBuilder sb = new StringBuilder();

      if (Boolean.TRUE.equals(preserveReplication)) {
        sb.append("r");
      }
      if (Boolean.TRUE.equals(preserveBlockSize)) {
        sb.append("b");
      }
      if (Boolean.TRUE.equals(preserveUser)) {
        sb.append("u");
      }
      if (Boolean.TRUE.equals(preserveGroup)) {
        sb.append("g");
      }
      if (Boolean.TRUE.equals(preservePermission)) {
        sb.append("p");
      }

      if (sb.length() > 0) {
        sb.insert(0, "-p");
      }

      return sb.toString();
    }
  private void doLoad(Element element) {
    for (final FTManager manager : getAllManagers()) {
      final Element templatesGroup = element.getChild(getXmlElementGroupName(manager));
      if (templatesGroup == null) {
        continue;
      }
      final List children = templatesGroup.getChildren(ELEMENT_TEMPLATE);

      for (final Object elem : children) {
        final Element child = (Element) elem;
        final String qName = child.getAttributeValue(ATTRIBUTE_NAME);
        final FileTemplateBase template = manager.getTemplate(qName);
        if (template == null) {
          continue;
        }
        template.setReformatCode(
            Boolean.TRUE.toString().equals(child.getAttributeValue(ATTRIBUTE_REFORMAT)));
        template.setLiveTemplateEnabled(
            Boolean.TRUE.toString().equals(child.getAttributeValue(ATTRIBUTE_LIVE_TEMPLATE)));
        if (template instanceof BundledFileTemplate) {
          final boolean enabled =
              Boolean.parseBoolean(child.getAttributeValue(ATTRIBUTE_ENABLED, "true"));
          ((BundledFileTemplate) template).setEnabled(enabled);
        }
      }
    }
  }
 static Predicate<ServiceConfiguration> listAllOrInternal(
     final Boolean listAllArg,
     final Boolean listUserServicesArg,
     final Boolean listInternalArg) {
   final boolean listAll = Boolean.TRUE.equals(listAllArg);
   final boolean listInternal = Boolean.TRUE.equals(listInternalArg);
   final boolean listUserServices = Boolean.TRUE.equals(listUserServicesArg);
   return new Predicate<ServiceConfiguration>() {
     @Override
     public boolean apply(final ServiceConfiguration input) {
       if (listAll) {
         return true;
       } else if (input.getComponentId().isDistributedService()
           || Empyrean.class.equals(input.getComponentId().getClass())) {
         return true;
       } else if (input.getComponentId().isPublicService()) {
         return Internets.testLocal(input.getHostName());
       } else if (input.getComponentId().isAdminService() && listUserServices) {
         return Internets.testLocal(input.getHostName());
       } else if (input.getComponentId().isInternal() && listInternal) {
         return Internets.testLocal(input.getHostName());
       } else {
         return false;
       }
     }
   };
 }
  /** {@inheritDoc} */
  public TreeNode wrap(final Group theObjectSource) throws ESCOWrapperException {

    TreeNode treeGroup = new TreeNode();
    Attributes attributes = new Attributes();

    attributes.setId(theObjectSource.getIdGroup());
    attributes.setName(theObjectSource.getName());
    attributes.setDisplayName(theObjectSource.getDisplayName());
    attributes.setType(TreeGroupWrapper.GROUP);
    attributes.setRight(theObjectSource.getUserRight().getName());
    if (theObjectSource.isCanOptin()) {
      attributes.setOptin(Boolean.TRUE.toString());
    } else {
      attributes.setOptin(Boolean.FALSE.toString());
    }
    if (theObjectSource.isCanOptout()) {
      attributes.setOptout(Boolean.TRUE.toString());
    } else {
      attributes.setOptout(Boolean.FALSE.toString());
    }

    treeGroup.setAttributes(attributes);
    treeGroup.setData(this.getViewDataFormatted(theObjectSource));
    treeGroup.setState("");

    return treeGroup;
  }
  public static DescribeServicesResponseType describeService(final DescribeServicesType request) {
    final DescribeServicesResponseType reply = request.getReply();
    Topology.touch(request);
    if (request.getServices().isEmpty()) {
      final ComponentId compId =
          (request.getByServiceType() != null)
              ? ComponentIds.lookup(request.getByServiceType().toLowerCase())
              : Empyrean.INSTANCE;
      final boolean showEventStacks = Boolean.TRUE.equals(request.getShowEventStacks());
      final boolean showEvents = Boolean.TRUE.equals(request.getShowEvents()) || showEventStacks;

      final Function<ServiceConfiguration, ServiceStatusType> transformToStatus =
          ServiceConfigurations.asServiceStatus(showEvents, showEventStacks);
      final List<Predicate<ServiceConfiguration>> filters =
          new ArrayList<Predicate<ServiceConfiguration>>() {
            {
              if (request.getByPartition() != null) {
                Partitions.exists(request.getByPartition());
                this.add(Filters.partition(request.getByPartition()));
              }
              if (request.getByState() != null) {
                final Component.State stateFilter =
                    Component.State.valueOf(request.getByState().toUpperCase());
                this.add(Filters.state(stateFilter));
              }
              if (!request.getServiceNames().isEmpty()) {
                this.add(Filters.name(request.getServiceNames()));
              }
              this.add(Filters.host(request.getByHost()));
              this.add(
                  Filters.listAllOrInternal(
                      request.getListAll(),
                      request.getListUserServices(),
                      request.getListInternal()));
            }
          };
      final Predicate<Component> componentFilter = Filters.componentType(compId);
      final Predicate<ServiceConfiguration> configPredicate = Predicates.and(filters);

      List<ServiceConfiguration> replyConfigs = Lists.newArrayList();
      for (final Component comp : Components.list()) {
        if (componentFilter.apply(comp)) {
          Collection<ServiceConfiguration> acceptedConfigs =
              Collections2.filter(comp.services(), configPredicate);
          replyConfigs.addAll(acceptedConfigs);
        }
      }
      ImmutableList<ServiceConfiguration> sortedReplyConfigs =
          ServiceOrderings.defaultOrdering().immutableSortedCopy(replyConfigs);
      final Collection<ServiceStatusType> transformedReplyConfigs =
          Collections2.transform(sortedReplyConfigs, transformToStatus);
      reply.getServiceStatuses().addAll(transformedReplyConfigs);
    } else {
      for (ServiceId s : request.getServices()) {
        reply.getServiceStatuses().add(TypeMappers.transform(s, ServiceStatusType.class));
      }
    }
    return reply;
  }
Пример #19
0
  public void testExecuteSubmitTrue() throws Exception {

    addRequestParameter(RhnAction.SUBMITTED, Boolean.TRUE.toString());
    addRequestParameter(RestartAction.RESTART, Boolean.TRUE.toString());
    actionPerform();
    verifyActionMessages(new String[] {"restart.config.success"});
    assertTrue((request.getParameter(RestartAction.RESTART).equals(Boolean.TRUE.toString())));
  }
Пример #20
0
 public MemoryProfile() {
   setParameter(Profile.IMTP, MemoryIMTPManager.class.getName());
   setParameter(Profile.NO_MTP, Boolean.TRUE.toString());
   setParameter(Profile.DETECT_MAIN, Boolean.FALSE.toString());
   setParameter(Profile.LOCAL_SERVICE_MANAGER, Boolean.FALSE.toString());
   setParameter(Profile.NO_DISPLAY, Boolean.TRUE.toString());
   setSpecifiers(Profile.MTPS, new ArrayList(0));
   setParameter(Profile.MTPS, null);
 }
Пример #21
0
  public void update(final AnActionEvent e) {
    final FileGroupInfo fileGroupInfo = new FileGroupInfo();

    myHelperAction.setFileIterationListener(fileGroupInfo);
    myHelperAction.update(e);

    myGetterStub.setDelegate(fileGroupInfo);

    if ((e.getPresentation().isEnabled())) {
      removeAll();
      if (myHelperAction.allAreIgnored()) {
        final DataContext dataContext = e.getDataContext();
        final Project project = CommonDataKeys.PROJECT.getData(dataContext);
        SvnVcs vcs = SvnVcs.getInstance(project);

        final Ref<Boolean> filesOk = new Ref<Boolean>(Boolean.FALSE);
        final Ref<Boolean> extensionOk = new Ref<Boolean>(Boolean.FALSE);

        // virtual files parameter is not used -> can pass null
        SvnPropertyService.doCheckIgnoreProperty(
            vcs,
            project,
            null,
            fileGroupInfo,
            fileGroupInfo.getExtensionMask(),
            filesOk,
            extensionOk);

        if (Boolean.TRUE.equals(filesOk.get())) {
          myRemoveExactAction.setActionText(
              fileGroupInfo.oneFileSelected()
                  ? fileGroupInfo.getFileName()
                  : SvnBundle.message("action.Subversion.UndoIgnore.text"));
          add(myRemoveExactAction);
        }

        if (Boolean.TRUE.equals(extensionOk.get())) {
          myRemoveExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myRemoveExtensionAction);
        }

        e.getPresentation().setText(SvnBundle.message("group.RevertIgnoreChoicesGroup.text"));
      } else if (myHelperAction.allCanBeIgnored()) {
        final String ignoreExactlyName =
            (fileGroupInfo.oneFileSelected())
                ? fileGroupInfo.getFileName()
                : SvnBundle.message("action.Subversion.Ignore.ExactMatch.text");
        myAddExactAction.setActionText(ignoreExactlyName);
        add(myAddExactAction);
        if (fileGroupInfo.sameExtension()) {
          myAddExtensionAction.setActionText(fileGroupInfo.getExtensionMask());
          add(myAddExtensionAction);
        }
        e.getPresentation().setText(SvnBundle.message("group.IgnoreChoicesGroup.text"));
      }
    }
  }
 @Override
 @SuppressWarnings("unchecked")
 protected void addConfigOptions(Map options) {
   options.put(AvailableSettings.USE_SECOND_LEVEL_CACHE, Boolean.TRUE.toString());
   options.put(AvailableSettings.CACHE_REGION_FACTORY, EhCacheRegionFactory.class.getName());
   options.put(AvailableSettings.USE_QUERY_CACHE, Boolean.TRUE.toString());
   options.put(AvailableSettings.GENERATE_STATISTICS, Boolean.TRUE.toString());
   options.put(AvailableSettings.CACHE_REGION_PREFIX, "");
 }
  @RequestMapping(value = "/summary/createUpdateDeliveryAddress.json", method = RequestMethod.POST)
  @RequireHardLogIn
  public String createUpdateDeliveryAddress(
      final Model model, @Valid final AddressForm form, final BindingResult bindingResult) {
    if (bindingResult.hasErrors()) {
      model.addAttribute("edit", Boolean.valueOf(StringUtils.isNotBlank(form.getAddressId())));
      // Work out if the address form should be displayed based on the payment type
      final B2BPaymentTypeData paymentType = getCheckoutFacade().getCheckoutCart().getPaymentType();
      final boolean payOnAccount =
          paymentType != null
              && CheckoutPaymentType.ACCOUNT.getCode().equals(paymentType.getCode());
      model.addAttribute("showAddressForm", Boolean.valueOf(!payOnAccount));

      return ControllerConstants.Views.Fragments.SingleStepCheckout.DeliveryAddressFormPopup;
    }

    // create delivery address and set it on cart
    final AddressData addressData = new AddressData();
    addressData.setId(form.getAddressId());
    addressData.setTitleCode(form.getTitleCode());
    addressData.setFirstName(form.getFirstName());
    addressData.setLastName(form.getLastName());
    addressData.setLine1(form.getLine1());
    addressData.setLine2(form.getLine2());
    addressData.setTown(form.getTownCity());
    addressData.setPostalCode(form.getPostcode());
    addressData.setCountry(getI18NFacade().getCountryForIsocode(form.getCountryIso()));
    addressData.setShippingAddress(
        Boolean.TRUE.equals(form.getShippingAddress())
            || Boolean.TRUE.equals(form.getSaveInAddressBook()));

    addressData.setVisibleInAddressBook(
        Boolean.TRUE.equals(form.getSaveInAddressBook())
            || StringUtils.isNotBlank(form.getAddressId()));
    addressData.setDefaultAddress(Boolean.TRUE.equals(form.getDefaultAddress()));

    if (StringUtils.isBlank(form.getAddressId())) {
      getUserFacade().addAddress(addressData);
    } else {
      getUserFacade().editAddress(addressData);
    }

    getCheckoutFacade().setDeliveryAddress(addressData);

    if (getCheckoutFacade().getCheckoutCart().getDeliveryMode() == null) {
      getCheckoutFacade().setDeliveryModeIfAvailable();
    }

    model.addAttribute("createUpdateStatus", "Success");
    model.addAttribute("addressId", addressData.getId());

    return REDIRECT_PREFIX
        + "/checkout/single/summary/getDeliveryAddressForm.json?addressId="
        + addressData.getId()
        + "&createUpdateStatus=Success";
  }
  @RequestMapping(value = "/select-suggested-address", method = RequestMethod.POST)
  public String doSelectSuggestedAddress(
      final AddressForm addressForm, final RedirectAttributes redirectModel) {
    final Set<String> resolveCountryRegions =
        org.springframework.util.StringUtils.commaDelimitedListToSet(
            Config.getParameter("resolve.country.regions"));

    final AddressData selectedAddress = new AddressData();
    selectedAddress.setId(addressForm.getAddressId());
    selectedAddress.setTitleCode(addressForm.getTitleCode());
    selectedAddress.setFirstName(addressForm.getFirstName());
    selectedAddress.setLastName(addressForm.getLastName());
    selectedAddress.setLine1(addressForm.getLine1());
    selectedAddress.setLine2(addressForm.getLine2());
    selectedAddress.setTown(addressForm.getTownCity());
    selectedAddress.setPostalCode(addressForm.getPostcode());
    selectedAddress.setBillingAddress(false);
    selectedAddress.setShippingAddress(true);
    selectedAddress.setVisibleInAddressBook(true);

    final CountryData countryData = i18NFacade.getCountryForIsocode(addressForm.getCountryIso());
    selectedAddress.setCountry(countryData);

    if (resolveCountryRegions.contains(countryData.getIsocode())) {
      if (addressForm.getRegionIso() != null && !StringUtils.isEmpty(addressForm.getRegionIso())) {
        final RegionData regionData =
            getI18NFacade().getRegion(addressForm.getCountryIso(), addressForm.getRegionIso());
        selectedAddress.setRegion(regionData);
      }
    }

    if (resolveCountryRegions.contains(countryData.getIsocode())) {
      if (addressForm.getRegionIso() != null && !StringUtils.isEmpty(addressForm.getRegionIso())) {
        final RegionData regionData =
            getI18NFacade().getRegion(addressForm.getCountryIso(), addressForm.getRegionIso());
        selectedAddress.setRegion(regionData);
      }
    }

    if (Boolean.TRUE.equals(addressForm.getEditAddress())) {
      selectedAddress.setDefaultAddress(
          Boolean.TRUE.equals(addressForm.getDefaultAddress())
              || userFacade.getAddressBook().size() <= 1);
      userFacade.editAddress(selectedAddress);
    } else {
      selectedAddress.setDefaultAddress(
          Boolean.TRUE.equals(addressForm.getDefaultAddress()) || userFacade.isAddressBookEmpty());
      userFacade.addAddress(selectedAddress);
    }

    GlobalMessages.addFlashMessage(
        redirectModel, GlobalMessages.CONF_MESSAGES_HOLDER, "account.confirmation.address.added");

    return REDIRECT_TO_ADDRESS_BOOK_PAGE;
  }
Пример #25
0
  @Override
  protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException {
    PatientElectiveListBedAdmissionVo patientElectiveList = null;
    if (Boolean.TRUE.equals(ConfigFlag.GEN.USE_ELECTIVE_LIST_FUNCTIONALITY.getValue())) {
      // Get current Patient Elective List
      patientElectiveList =
          domain.getPatientElectiveListForAppointment(
              form.getGlobalContext().Scheduling.getBookingAppointmentRef());

      if (patientElectiveList != null) {
        if (Specialty.EMERGENCY.equals(form.cmbSpecialty().getValue())) {
          // If there are no other elective list to be cancelled
          TCIOutcomeForPatientElectiveListVo outcome = new TCIOutcomeForPatientElectiveListVo();

          if (ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason()))
            outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED);
          else outcome.setOutcome(AdmissionOfferOutcome.PATIENT_ADMITTED_COMMENCED_8);

          outcome.setChangeBy((MemberOfStaffRefVo) domain.getMosUser());
          outcome.setStatusDateTime(new DateTime());
          outcome.setOutcomeReason(null);

          patientElectiveList.getTCIDetails().setCurrentOutcome(outcome);
          patientElectiveList.getTCIDetails().getOutcomeHistory().add(outcome);
          patientElectiveList.getTCIDetails().setIsActive(Boolean.FALSE);

          if (ElectiveListReason.DIAGNOSTIC.equals(patientElectiveList.getElectiveListReason())) {
            if (patientElectiveList.getPathwayClock() != null)
              patientElectiveList
                  .getPathwayClock()
                  .setStopDate(
                      form.dtimAdmDateTime().getValue() != null
                          ? form.dtimAdmDateTime().getValue().getDate()
                          : null);
          }

          // Check for existing Patient Elective list
          if (Boolean.TRUE.equals(
              domain.hasPatientElectiveListsToBeCancelled(
                  form.getGlobalContext().Core.getPatientShort(),
                  patientElectiveList,
                  patientElectiveList.getElectiveList().getService()))) {
            form.getLocalContext().setPatientElectiveList(patientElectiveList);
            engine.showMessage(
                "Patient has other Patient Elective records for the same service. Cancel these records?",
                "Warning",
                MessageButtons.YESNOCANCEL);
            return;
          }
        }
      }
    }

    if (saveAdmission(patientElectiveList, null)) engine.close(DialogResult.OK);
  }
Пример #26
0
 public final Session getSession() throws IOException {
   final Properties propertiesSession = new Properties();
   // properties.setProperty("mail.debug", "true");
   if ("starttls".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.starttls.enable", Boolean.TRUE.toString());
   } else if ("smtps".equals(cursorSMTP.getProtocol())) { // i18n revisit
     propertiesSession.setProperty("mail.smtp.ssl.enable", Boolean.TRUE.toString());
   }
   setCustomSocketFactory(cursorSMTP.getCertificate(), propertiesSession);
   return Session.getInstance(propertiesSession);
 }
Пример #27
0
    public void restoreState(FacesContext context, UIOrderingList list, Object _state) {
      Object[] state = (Object[]) _state;

      value = restoreAttachedState(context, state[0]);

      selection = (Set) restoreAttachedState(context, state[1]);
      selectionSet = Boolean.TRUE.equals(state[2]);

      activeItem = restoreAttachedState(context, state[3]);
      activeItemSet = Boolean.TRUE.equals(state[4]);
    }
Пример #28
0
  /**
   * Test.
   *
   * @throws Exception e
   */
  @Test
  public void testOtherWrites() throws Exception { // NOPMD
    final HtmlReport htmlReport =
        new HtmlReport(collector, null, javaInformationsList, Period.SEMAINE, writer);

    htmlReport.writeAllCurrentRequestsAsPart();
    assertNotEmptyAndClear(writer);
    htmlReport.writeAllThreadsAsPart();
    assertNotEmptyAndClear(writer);

    htmlReport.writeSessionDetail("", null);
    assertNotEmptyAndClear(writer);
    htmlReport.writeSessions(
        Collections.<SessionInformations>emptyList(), "message", SESSIONS_PART);
    assertNotEmptyAndClear(writer);
    htmlReport.writeSessions(Collections.<SessionInformations>emptyList(), null, SESSIONS_PART);
    assertNotEmptyAndClear(writer);
    htmlReport.writeMBeans(MBeans.getAllMBeanNodes());
    assertNotEmptyAndClear(writer);
    htmlReport.writeProcesses(
        ProcessInformations.buildProcessInformations(
            getClass().getResourceAsStream("/tasklist.txt"), true, false));
    assertNotEmptyAndClear(writer);
    htmlReport.writeProcesses(
        ProcessInformations.buildProcessInformations(
            getClass().getResourceAsStream("/ps.txt"), false, false));
    assertNotEmptyAndClear(writer);
    HtmlReport.writeAddAndRemoveApplicationLinks(null, writer);
    assertNotEmptyAndClear(writer);
    HtmlReport.writeAddAndRemoveApplicationLinks("test", writer);
    assertNotEmptyAndClear(writer);
    final Connection connection = TestDatabaseInformations.initH2();
    try {
      htmlReport.writeDatabase(new DatabaseInformations(0)); // h2.memory
      assertNotEmptyAndClear(writer);
      htmlReport.writeDatabase(new DatabaseInformations(3)); // h2.settings avec nbColumns==2
      assertNotEmptyAndClear(writer);
      JavaInformations.setWebXmlExistsAndPomXmlExists(true, true);
      htmlReport.toHtml(null, null); // pom.xml dans HtmlJavaInformationsReport.writeDependencies
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.SYSTEM_ACTIONS_ENABLED, Boolean.TRUE.toString());
      htmlReport.toHtml(null, null); // writeSystemActionsLinks
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.NO_DATABASE, Boolean.TRUE.toString());
      htmlReport.toHtml(null, null); // writeSystemActionsLinks
      assertNotEmptyAndClear(writer);
      setProperty(Parameter.CUSTOM_REPORTS, "custom,dummy");
      System.setProperty(Parameters.PARAMETER_SYSTEM_PREFIX + "custom", "custom.jsp");
      htmlReport.toHtml(null, null); // writeMenu
      assertNotEmptyAndClear(writer);
    } finally {
      connection.close();
    }
  }
 public Boolean a() {
   if (this.b == null) this.b = a(Boolean.class, IsNativeNewsFeedEnabled.class);
   if (!Boolean.TRUE.equals(this.b.b())) ;
   for (Boolean localBoolean = Boolean.valueOf(false);
       ;
       localBoolean =
           Boolean.valueOf(
               Boolean.TRUE.equals(
                   Gatekeeper.a(
                       FbandroidAppModule.a(this.a), "android_mustang_log_fetch_errors"))))
     return localBoolean;
 }
Пример #30
0
  public static void invokeAndWaitInterruptedWhenClosing(
      final Project project, final Runnable runnable, final ModalityState modalityState) {
    final Ref<Boolean> start = new Ref<Boolean>(Boolean.TRUE);
    final Application application = ApplicationManager.getApplication();
    LOG.assertTrue(!application.isDispatchThread());

    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    Runnable runnable1 =
        new Runnable() {
          public void run() {
            try {
              runnable.run();
            } finally {
              semaphore.up();
            }
          }

          @NonNls
          public String toString() {
            return "PeriodicalTaskCloser's invoke and wait [" + runnable.toString() + "]";
          }
        };
    LaterInvocator.invokeLater(
        runnable1,
        modalityState,
        new Condition<Object>() {
          public boolean value(Object o) {
            synchronized (start) {
              return !start.get();
            }
          }
        });

    while (true) {
      if (semaphore.waitFor(1000)) {
        return;
      }
      final Ref<Boolean> fire = new Ref<Boolean>();
      synchronized (ourLock) {
        final Boolean state = myStates.get(project);
        if (!Boolean.TRUE.equals(state)) {
          fire.set(Boolean.TRUE);
        }
        if (Boolean.TRUE.equals(fire.get())) {
          synchronized (start) {
            start.set(Boolean.FALSE);
            return;
          }
        }
      }
    }
  }