Ejemplo n.º 1
0
 void LoadConfig() {
   String id = Long.toString(robot_uid);
   limit_top = Double.valueOf(prefs.get(id + "_limit_top", "0"));
   limit_bottom = Double.valueOf(prefs.get(id + "_limit_bottom", "0"));
   limit_left = Double.valueOf(prefs.get(id + "_limit_left", "0"));
   limit_right = Double.valueOf(prefs.get(id + "_limit_right", "0"));
   m1invert = Boolean.parseBoolean(prefs.get(id + "_m1invert", "false"));
   m2invert = Boolean.parseBoolean(prefs.get(id + "_m2invert", "false"));
 }
Ejemplo n.º 2
0
  public boolean getBoolean(String envName, String propertyName, boolean defaultValue) {
    if (System.getenv(envName) != null) {
      return Boolean.parseBoolean(System.getenv(envName));
    }

    if (System.getProperty(propertyName) != null) {
      return Boolean.parseBoolean(System.getProperty(propertyName));
    }
    return getBooleanValue(propertyName, defaultValue);
  }
 private static Pair<boolean[], Boolean> parseFlags(final String string) {
   final int returnIdx = string.indexOf(':');
   boolean returnFlag = returnIdx != -1 && Boolean.parseBoolean(string.substring(0, returnIdx));
   final StringTokenizer st = new StringTokenizer(string.substring(returnIdx + 1), ",");
   final boolean[] result = new boolean[st.countTokens()];
   for (int i = 0; i < result.length; i++) {
     result[i] = Boolean.parseBoolean(st.nextToken());
   }
   return Pair.create(result, returnFlag);
 }
Ejemplo n.º 4
0
  private void processChildTables(
      Map<String, TableConfig> tables,
      TableConfig parentTable,
      String dataNodes,
      Element tableNode) {
    // parse child tables
    NodeList childNodeList = tableNode.getChildNodes();
    for (int j = 0; j < childNodeList.getLength(); j++) {
      Node theNode = childNodeList.item(j);
      if (!theNode.getNodeName().equals("childTable")) {
        continue;
      }
      Element childTbElement = (Element) theNode;

      String cdTbName = childTbElement.getAttribute("name").toUpperCase();
      String primaryKey =
          childTbElement.hasAttribute("primaryKey")
              ? childTbElement.getAttribute("primaryKey").toUpperCase()
              : null;

      boolean autoIncrement = false;
      if (childTbElement.hasAttribute("autoIncrement")) {
        autoIncrement = Boolean.parseBoolean(childTbElement.getAttribute("autoIncrement"));
      }
      boolean needAddLimit = true;
      if (childTbElement.hasAttribute("needAddLimit")) {
        needAddLimit = Boolean.parseBoolean(childTbElement.getAttribute("needAddLimit"));
      }
      String joinKey = childTbElement.getAttribute("joinKey").toUpperCase();
      String parentKey = childTbElement.getAttribute("parentKey").toUpperCase();
      TableConfig table =
          new TableConfig(
              cdTbName,
              primaryKey,
              autoIncrement,
              needAddLimit,
              TableConfig.TYPE_GLOBAL_DEFAULT,
              dataNodes,
              getDbType(dataNodes),
              null,
              false,
              parentTable,
              true,
              joinKey,
              parentKey);
      if (tables.containsKey(table.getName())) {
        throw new ConfigException("table " + table.getName() + " duplicated!");
      }
      tables.put(table.getName(), table);
      processChildTables(tables, table, dataNodes, childTbElement);
    }
  }
Ejemplo n.º 5
0
  private void handleSpecialCommands(Map<String, Object> arow, DocWrapper doc) {
    Object value = arow.get("$deleteDocById");
    if (value != null) {
      if (value instanceof Collection) {
        Collection collection = (Collection) value;
        for (Object o : collection) {
          writer.deleteDoc(o.toString());
        }
      } else {
        writer.deleteDoc(value);
      }
    }
    value = arow.get("$deleteDocByQuery");
    if (value != null) {
      if (value instanceof Collection) {
        Collection collection = (Collection) value;
        for (Object o : collection) {
          writer.deleteByQuery(o.toString());
        }
      } else {
        writer.deleteByQuery(value.toString());
      }
    }
    value = arow.get("$docBoost");
    if (value != null) {
      float value1 = 1.0f;
      if (value instanceof Number) {
        value1 = ((Number) value).floatValue();
      } else {
        value1 = Float.parseFloat(value.toString());
      }
      doc.setDocumentBoost(value1);
    }

    value = arow.get("$skipDoc");
    if (value != null) {
      if (Boolean.parseBoolean(value.toString())) {
        throw new DataImportHandlerException(
            DataImportHandlerException.SKIP, "Document skipped :" + arow);
      }
    }

    value = arow.get("$skipRow");
    if (value != null) {
      if (Boolean.parseBoolean(value.toString())) {
        throw new DataImportHandlerException(DataImportHandlerException.SKIP_ROW);
      }
    }
  }
 private boolean importOldIndentOptions(@NonNls Element element) {
   final List options = element.getChildren("option");
   boolean optionsImported = false;
   for (Object option1 : options) {
     @NonNls Element option = (Element) option1;
     @NonNls final String name = option.getAttributeValue("name");
     if ("TAB_SIZE".equals(name)) {
       final int value = Integer.parseInt(option.getAttributeValue("value"));
       JAVA_INDENT_OPTIONS.TAB_SIZE = value;
       JSP_INDENT_OPTIONS.TAB_SIZE = value;
       XML_INDENT_OPTIONS.TAB_SIZE = value;
       OTHER_INDENT_OPTIONS.TAB_SIZE = value;
       optionsImported = true;
     } else if ("INDENT_SIZE".equals(name)) {
       final int value = Integer.parseInt(option.getAttributeValue("value"));
       JAVA_INDENT_OPTIONS.INDENT_SIZE = value;
       JSP_INDENT_OPTIONS.INDENT_SIZE = value;
       XML_INDENT_OPTIONS.INDENT_SIZE = value;
       OTHER_INDENT_OPTIONS.INDENT_SIZE = value;
       optionsImported = true;
     } else if ("CONTINUATION_INDENT_SIZE".equals(name)) {
       final int value = Integer.parseInt(option.getAttributeValue("value"));
       JAVA_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
       JSP_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
       XML_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
       OTHER_INDENT_OPTIONS.CONTINUATION_INDENT_SIZE = value;
       optionsImported = true;
     } else if ("USE_TAB_CHARACTER".equals(name)) {
       final boolean value = Boolean.parseBoolean(option.getAttributeValue("value"));
       JAVA_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
       JSP_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
       XML_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
       OTHER_INDENT_OPTIONS.USE_TAB_CHARACTER = value;
       optionsImported = true;
     } else if ("SMART_TABS".equals(name)) {
       final boolean value = Boolean.parseBoolean(option.getAttributeValue("value"));
       JAVA_INDENT_OPTIONS.SMART_TABS = value;
       JSP_INDENT_OPTIONS.SMART_TABS = value;
       XML_INDENT_OPTIONS.SMART_TABS = value;
       OTHER_INDENT_OPTIONS.SMART_TABS = value;
       optionsImported = true;
     } else if ("SPACE_AFTER_UNARY_OPERATOR".equals(name)) {
       SPACE_AROUND_UNARY_OPERATOR = Boolean.parseBoolean(option.getAttributeValue("value"));
       optionsImported = true;
     }
   }
   return optionsImported;
 }
  /**
   * Parses the arguments table from the GATK Report and creates a RAC object with the proper
   * initialization values
   *
   * @param table the GATKReportTable containing the arguments and its corresponding values
   * @return a RAC object properly initialized with all the objects in the table
   */
  private RecalibrationArgumentCollection initializeArgumentCollectionTable(GATKReportTable table) {
    final RecalibrationArgumentCollection RAC = new RecalibrationArgumentCollection();

    for (int i = 0; i < table.getNumRows(); i++) {
      final String argument = table.get(i, "Argument").toString();
      Object value = table.get(i, RecalUtils.ARGUMENT_VALUE_COLUMN_NAME);
      if (value.equals("null"))
        value =
            null; // generic translation of null values that were printed out as strings | todo --
                  // add this capability to the GATKReport

      if (argument.equals("covariate") && value != null)
        RAC.COVARIATES = value.toString().split(",");
      else if (argument.equals("standard_covs"))
        RAC.DO_NOT_USE_STANDARD_COVARIATES = Boolean.parseBoolean((String) value);
      else if (argument.equals("solid_recal_mode"))
        RAC.SOLID_RECAL_MODE = RecalUtils.SOLID_RECAL_MODE.recalModeFromString((String) value);
      else if (argument.equals("solid_nocall_strategy"))
        RAC.SOLID_NOCALL_STRATEGY =
            RecalUtils.SOLID_NOCALL_STRATEGY.nocallStrategyFromString((String) value);
      else if (argument.equals("mismatches_context_size"))
        RAC.MISMATCHES_CONTEXT_SIZE = Integer.parseInt((String) value);
      else if (argument.equals("indels_context_size"))
        RAC.INDELS_CONTEXT_SIZE = Integer.parseInt((String) value);
      else if (argument.equals("mismatches_default_quality"))
        RAC.MISMATCHES_DEFAULT_QUALITY = Byte.parseByte((String) value);
      else if (argument.equals("insertions_default_quality"))
        RAC.INSERTIONS_DEFAULT_QUALITY = Byte.parseByte((String) value);
      else if (argument.equals("deletions_default_quality"))
        RAC.DELETIONS_DEFAULT_QUALITY = Byte.parseByte((String) value);
      else if (argument.equals("maximum_cycle_value"))
        RAC.MAXIMUM_CYCLE_VALUE = Integer.parseInt((String) value);
      else if (argument.equals("low_quality_tail"))
        RAC.LOW_QUAL_TAIL = Byte.parseByte((String) value);
      else if (argument.equals("default_platform")) RAC.DEFAULT_PLATFORM = (String) value;
      else if (argument.equals("force_platform")) RAC.FORCE_PLATFORM = (String) value;
      else if (argument.equals("quantizing_levels"))
        RAC.QUANTIZING_LEVELS = Integer.parseInt((String) value);
      else if (argument.equals("recalibration_report"))
        RAC.existingRecalibrationReport = (value == null) ? null : new File((String) value);
      else if (argument.equals("binary_tag_name"))
        RAC.BINARY_TAG_NAME = (value == null) ? null : (String) value;
      else if (argument.equals("sort_by_all_columns"))
        RAC.SORT_BY_ALL_COLUMNS = Boolean.parseBoolean((String) value);
    }

    return RAC;
  }
Ejemplo n.º 8
0
 public boolean getMethodParameter(String method, String key, boolean defaultValue) {
   String value = getMethodParameter(method, key);
   if (value == null || value.length() == 0) {
     return defaultValue;
   }
   return Boolean.parseBoolean(value);
 }
  @Override
  public void initialize(
      @NotNull ManagingFS managingFS, @NotNull FileWatcherNotificationSink notificationSink) {
    myManagingFS = managingFS;
    myNotificationSink = notificationSink;

    boolean disabled = Boolean.parseBoolean(System.getProperty(PROPERTY_WATCHER_DISABLED));
    myExecutable = getExecutable();

    if (disabled) {
      LOG.info("Native file watcher is disabled");
    } else if (myExecutable == null) {
      LOG.info("Native file watcher is not supported on this platform");
    } else if (!myExecutable.exists()) {
      notifyOnFailure(ApplicationBundle.message("watcher.exe.not.found"), null);
    } else if (!myExecutable.canExecute()) {
      notifyOnFailure(
          ApplicationBundle.message("watcher.exe.not.exe", myExecutable),
          new NotificationListener() {
            @Override
            public void hyperlinkUpdate(
                @NotNull Notification notification, @NotNull HyperlinkEvent event) {
              ShowFilePathAction.openFile(myExecutable);
            }
          });
    } else {
      try {
        startupProcess(false);
        LOG.info("Native file watcher is operational.");
      } catch (IOException e) {
        LOG.warn(e.getMessage());
        notifyOnFailure(ApplicationBundle.message("watcher.failed.to.start"), null);
      }
    }
  }
 @Override
 public boolean isEventDuplicatedInCluster() {
   return Boolean.parseBoolean(
       eventAdapterConfiguration
           .getProperties()
           .get(EventAdapterConstants.EVENTS_DUPLICATED_IN_CLUSTER));
 }
Ejemplo n.º 11
0
  @Override
  public void init(Context context, Properties initProps) {
    initProps = decryptPwd(initProps);
    Object o = initProps.get(CONVERT_TYPE);
    if (o != null) convertType = Boolean.parseBoolean(o.toString());

    factory = createConnectionFactory(context, initProps);

    String bsz = initProps.getProperty("batchSize");
    if (bsz != null) {
      bsz = context.replaceTokens(bsz);
      try {
        batchSize = Integer.parseInt(bsz);
        if (batchSize == -1) batchSize = Integer.MIN_VALUE;
      } catch (NumberFormatException e) {
        LOG.warn("Invalid batch size: " + bsz);
      }
    }

    for (Map<String, String> map : context.getAllEntityFields()) {
      String n = map.get(DataImporter.COLUMN);
      String t = map.get(DataImporter.TYPE);
      if ("sint".equals(t) || "integer".equals(t)) fieldNameVsType.put(n, Types.INTEGER);
      else if ("slong".equals(t) || "long".equals(t)) fieldNameVsType.put(n, Types.BIGINT);
      else if ("float".equals(t) || "sfloat".equals(t)) fieldNameVsType.put(n, Types.FLOAT);
      else if ("double".equals(t) || "sdouble".equals(t)) fieldNameVsType.put(n, Types.DOUBLE);
      else if ("date".equals(t)) fieldNameVsType.put(n, Types.DATE);
      else if ("boolean".equals(t)) fieldNameVsType.put(n, Types.BOOLEAN);
      else if ("binary".equals(t)) fieldNameVsType.put(n, Types.BLOB);
      else fieldNameVsType.put(n, Types.VARCHAR);
    }
  }
Ejemplo n.º 12
0
  @Override
  public void meet(ValueConstant node) throws RuntimeException {
    String val = node.getValue().stringValue();

    switch (optypes.peek()) {
      case STRING:
      case URI:
        builder.append("'").append(val).append("'");
        break;
      case INT:
        builder.append(Integer.parseInt(val));
        break;
      case DECIMAL:
      case DOUBLE:
        builder.append(Double.parseDouble(val));
        break;
      case BOOL:
        builder.append(Boolean.parseBoolean(val));
        break;
      case DATE:
        builder.append("'").append(sqlDateFormat.format(DateUtils.parseDate(val))).append("'");
        break;

        // in this case we should return a node ID and also need to make sure it actually exists
      case TERM:
      case NODE:
        KiWiNode n = parent.getConverter().convert(node.getValue());
        builder.append(n.getId());
        break;

      default:
        throw new IllegalArgumentException("unsupported value type: " + optypes.peek());
    }
  }
Ejemplo n.º 13
0
 /**
  * Convert the string input param value to its typed object value.
  *
  * @param value The string value of the input param
  * @param type The type of the input value, defined at DBConstants.DataTypes.
  * @return The typed object value of the input param
  */
 public static Object convertInputParamValue(String value, String type) throws DataServiceFault {
   try {
     if (DBConstants.DataTypes.INTEGER.equals(type)) {
       return Integer.parseInt(value);
     } else if (DBConstants.DataTypes.LONG.equals(type)) {
       return Long.parseLong(value);
     } else if (DBConstants.DataTypes.FLOAT.equals(type)) {
       return Float.parseFloat(value);
     } else if (DBConstants.DataTypes.DOUBLE.equals(type)) {
       return Double.parseDouble(value);
     } else if (DBConstants.DataTypes.BOOLEAN.equals(type)) {
       return Boolean.parseBoolean(value);
     } else if (DBConstants.DataTypes.DATE.equals(type)) {
       return new java.util.Date(DBUtils.getDate(value).getTime());
     } else if (DBConstants.DataTypes.TIME.equals(type)) {
       Calendar cal = Calendar.getInstance();
       cal.setTimeInMillis(DBUtils.getTime(value).getTime());
       return cal;
     } else if (DBConstants.DataTypes.TIMESTAMP.equals(type)) {
       Calendar cal = Calendar.getInstance();
       cal.setTimeInMillis(DBUtils.getTimestamp(value).getTime());
       return cal;
     } else {
       return value;
     }
   } catch (Exception e) {
     throw new DataServiceFault(e);
   }
 }
Ejemplo n.º 14
0
  /**
   * Method getBoolean returns the element at the given position as a boolean. If the value is (case
   * ignored) the string 'true', a {@code true} value will be returned. {@code false} if null.
   *
   * @param pos of type int
   * @return boolean
   */
  public boolean getBoolean(int pos) {
    Comparable value = get(pos);

    if (value instanceof Boolean) return ((Boolean) value).booleanValue();
    else if (value == null) return false;
    else return Boolean.parseBoolean(value.toString());
  }
Ejemplo n.º 15
0
  public void configure(final Properties configuration) throws ConfigurationException {
    if (!configuration.containsKey("project")) {
      throw new ConfigurationException("project is required");
    }
    project = configuration.getProperty("project");
    if (!configuration.containsKey(CONFIG_FILE)) {
      throw new ConfigurationException(CONFIG_FILE + " is required");
    }
    scriptFile = new File(configuration.getProperty(CONFIG_FILE));
    if (!scriptFile.isFile()) {
      throw new ConfigurationException(
          CONFIG_FILE + " does not exist or is not a file: " + scriptFile.getAbsolutePath());
    }
    interpreter = configuration.getProperty(CONFIG_INTERPRETER);
    args = configuration.getProperty(CONFIG_ARGS);
    if (!configuration.containsKey(CONFIG_FORMAT)) {
      throw new ConfigurationException(CONFIG_FORMAT + " is required");
    }
    format = configuration.getProperty(CONFIG_FORMAT);

    interpreterArgsQuoted =
        Boolean.parseBoolean(configuration.getProperty(CONFIG_INTERPRETER_ARGS_QUOTED));

    configDataContext = new HashMap<String, Map<String, String>>();
    final HashMap<String, String> configdata = new HashMap<String, String>();
    configdata.put("project", project);
    configDataContext.put("context", configdata);

    executionDataContext =
        ScriptDataContextUtil.createScriptDataContextForProject(framework, project);

    executionDataContext.putAll(configDataContext);
  }
  public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    final String locked = element.getAttributeValue(IS_LOCKED);
    if (locked != null) {
      myLockedProfile = Boolean.parseBoolean(locked);
    }
    myBaseProfile = getDefaultProfile();
    final String version = element.getAttributeValue(VERSION_TAG);
    if (version == null || !version.equals(VALID_VERSION)) {
      try {
        element = InspectionProfileConvertor.convertToNewFormat(element, this);
      } catch (IOException e) {
        LOG.error(e);
      } catch (JDOMException e) {
        LOG.error(e);
      }
    }

    final Element highlightElement = element.getChild(USED_LEVELS);
    if (highlightElement != null) { // from old profiles
      ((SeverityProvider) getProfileManager())
          .getOwnSeverityRegistrar()
          .readExternal(highlightElement);
    }

    for (final Object o : element.getChildren(INSPECTION_TOOL_TAG)) {
      Element toolElement = (Element) o;

      String toolClassName = toolElement.getAttributeValue(CLASS_TAG);

      myDeinstalledInspectionsSettings.put(toolClassName, toolElement);
    }
  }
Ejemplo n.º 17
0
 public boolean getBoolean(String key, boolean def) {
   try {
     String v = getValue(key);
     if (v != null) return Boolean.parseBoolean(v);
   } catch (Exception e) {
   }
   return def;
 }
Ejemplo n.º 18
0
  protected AbstractPhraseExtractor(
      Properties prop, AlignmentTemplates alTemps, List<AbstractFeatureExtractor> extractors) {

    // System.err.println("AbstractPhraseExtractor: "+maxPhraseLenF);
    this.alTemps = alTemps;
    this.extractors = extractors;
    this.alTemp = new AlignmentTemplateInstance();
    this.alGrid = new AlignmentGrid(0, 0);

    boolean addBoundaryMarkers =
        Boolean.parseBoolean(
            prop.getProperty(SymmetricalWordAlignment.ADD_BOUNDARY_MARKERS_OPT, "false"));
    boolean unalignedBoundaryMarkers =
        Boolean.parseBoolean(
            prop.getProperty(SymmetricalWordAlignment.UNALIGN_BOUNDARY_MARKERS_OPT, "false"));
    extractBoundaryPhrases = (addBoundaryMarkers && unalignedBoundaryMarkers);
  }
 public boolean isProperty(String name, boolean defaultValue) {
   String val = getProperty(name);
   if (isBlank(val)) {
     return defaultValue;
   } else {
     return Boolean.parseBoolean(val);
   }
 }
Ejemplo n.º 20
0
  private boolean resolveBooleanArg(String arg, boolean defaultValue) {
    if (arg == null) return defaultValue;

    try {
      return Boolean.parseBoolean(arg);
    } catch (Exception e) {
      return defaultValue;
    }
  }
Ejemplo n.º 21
0
 public static LogEntry parseDump(HashMap<String, String> dump) {
   LogEntry build = new LogEntry(Boolean.parseBoolean(dump.get("LoggingIn?")));
   try {
     build.timeframe = parser.parse(dump.get("Time"));
   } catch (ParseException e) {
     e.printStackTrace();
   }
   return build;
 }
Ejemplo n.º 22
0
  /**
   * Returns TRUE if logged to Devel instance of Perun
   *
   * @return TRUE if instance of Perun is Devel / FALSE otherwise
   */
  public static boolean isDevel() {

    if (PerunWebSession.getInstance().getConfiguration() != null) {
      String value = PerunWebSession.getInstance().getConfiguration().getCustomProperty("isDevel");
      if (value != null && !value.isEmpty()) {
        return Boolean.parseBoolean(value);
      }
    }
    return false;
  }
  private void readScheme(Element node) {
    myDeprecatedBackgroundColor = null;
    if (!SCHEME_ELEMENT.equals(node.getName())) {
      return;
    }

    setName(node.getAttributeValue(NAME_ATTR));
    int readVersion = Integer.parseInt(node.getAttributeValue(VERSION_ATTR, "0"));
    if (readVersion > CURR_VERSION) {
      throw new IllegalStateException("Unsupported color scheme version: " + readVersion);
    }

    myVersion = readVersion;
    String isDefaultScheme = node.getAttributeValue(DEFAULT_SCHEME_ATTR);
    boolean isDefault = isDefaultScheme != null && Boolean.parseBoolean(isDefaultScheme);
    if (!isDefault) {
      myParentScheme =
          DefaultColorSchemesManager.getInstance()
              .getScheme(node.getAttributeValue(PARENT_SCHEME_ATTR, DEFAULT_SCHEME_NAME));
    }

    for (final Object o : node.getChildren()) {
      Element childNode = (Element) o;
      String childName = childNode.getName();
      if (OPTION_ELEMENT.equals(childName)) {
        readSettings(childNode, isDefault);
      } else if (EDITOR_FONT.equals(childName)) {
        readFontSettings(childNode, myFontPreferences, isDefault);
      } else if (CONSOLE_FONT.equals(childName)) {
        readFontSettings(childNode, myConsoleFontPreferences, isDefault);
      } else if (COLORS_ELEMENT.equals(childName)) {
        readColors(childNode);
      } else if (ATTRIBUTES_ELEMENT.equals(childName)) {
        readAttributes(childNode);
      }
    }

    if (myDeprecatedBackgroundColor != null) {
      TextAttributes textAttributes = myAttributesMap.get(HighlighterColors.TEXT);
      if (textAttributes == null) {
        textAttributes =
            new TextAttributes(
                Color.black, myDeprecatedBackgroundColor, null, EffectType.BOXED, Font.PLAIN);
        myAttributesMap.put(HighlighterColors.TEXT, textAttributes);
      } else {
        textAttributes.setBackgroundColor(myDeprecatedBackgroundColor);
      }
    }

    if (myConsoleFontPreferences.getEffectiveFontFamilies().isEmpty()) {
      myFontPreferences.copyTo(myConsoleFontPreferences);
    }

    initFonts();
  }
    @Override
    protected void updateStatus(Attributes attributes, PortableStatus status, Lock.Builder lock)
        throws SAXException {
      final StatusType propertiesStatus = parsePropertiesStatus(attributes);
      status.setPropertiesStatus(propertiesStatus);
      final StatusType contentsStatus = parseContentsStatus(attributes);
      status.setContentsStatus(contentsStatus);

      if (StatusType.STATUS_CONFLICTED.equals(propertiesStatus)
          || StatusType.STATUS_CONFLICTED.equals(contentsStatus)) {
        status.setIsConflicted(true);
      }

      // optional
      final String locked = attributes.getValue("wc-locked");
      if (locked != null && Boolean.parseBoolean(locked)) {
        status.setIsLocked(true);
      }
      final String copied = attributes.getValue("copied");
      if (copied != null && Boolean.parseBoolean(copied)) {
        status.setIsCopied(true);
      }
      final String treeConflicted = attributes.getValue("tree-conflicted");
      if (treeConflicted != null && Boolean.parseBoolean(treeConflicted)) {
        status.setIsConflicted(true);
      }

      final String switched = attributes.getValue("switched");
      if (switched != null && Boolean.parseBoolean(switched)) {
        status.setIsSwitched(true);
      }

      final String revision = attributes.getValue("revision");
      if (!StringUtil.isEmptyOrSpaces(revision)) {
        try {
          final long number = Long.parseLong(revision);
          status.setRevision(SVNRevision.create(number));
        } catch (NumberFormatException e) {
          throw new SAXException(e);
        }
      }
    }
Ejemplo n.º 25
0
  /**
   * The handler for the security event received. The security event for starting establish a secure
   * connection.
   *
   * @param evt the security started event received
   */
  public void securityNegotiationStarted(CallPeerSecurityNegotiationStartedEvent evt) {
    if (Boolean.parseBoolean(
        GuiActivator.getResources().getSettingsString("impl.gui.PARANOIA_UI"))) {
      SrtpControl srtpControl = null;
      if (callPeer instanceof MediaAwareCallPeer) srtpControl = evt.getSecurityController();

      securityPanel = new ParanoiaTimerSecurityPanel<SrtpControl>(srtpControl);

      setSecurityPanelVisible(true);
    }
  }
Ejemplo n.º 26
0
  /** @return <code>true</code> if template caching is enabled. */
  private boolean isCaching() {
    /*
     * Global override takes precedence.
     */
    final String global = System.getProperty(TEMPLATE_CACHING_PROPERTY);
    if (global != null) {
      return Boolean.parseBoolean(global);
    }

    return templateCaching;
  }
Ejemplo n.º 27
0
 @Before
 public void setUp() {
   if (!Boolean.parseBoolean(System.getProperty("test.solr.verbose"))) {
     java.util.logging.Logger.getLogger("org.apache.solr")
         .setLevel(java.util.logging.Level.SEVERE);
     Utils.setLog4jLogLevel(org.apache.log4j.Level.WARN);
   }
   testDataParentPath = System.getProperty("test.data.path");
   testConfigFname = System.getProperty("test.config.file");
   // System.out.println("-----testDataParentPath = "+testDataParentPath);
 }
  public void readExternal(Element element) throws InvalidDataException {
    //noinspection unchecked

    final String showRecycled = element.getAttributeValue(ATTRIBUTE_SHOW_RECYCLED);
    if (showRecycled != null) {
      myShowRecycled = Boolean.parseBoolean(showRecycled);
    } else {
      myShowRecycled = true;
    }

    readExternal(element, myShelvedChangeLists, myRecycledShelvedChangeLists);
  }
Ejemplo n.º 29
0
  public ListEventsPage() {
    if (!Boolean.parseBoolean(environment.getProperty(Toggles.CALENDAR))
        && !CsldAuthenticatedWebSession.get().isAtLeastEditor()) {
      throw new RestartResponseException(HomePage.class);
    }

    URL pathToShape = GeographicalFilter.class.getResource("CZE_adm1.shp");

    FilterEvent defaultFilter = new FilterEvent(new GeographicalFilter(pathToShape));
    defaultFilter.setFrom(Calendar.getInstance().getTime());
    filterModel = new Model(defaultFilter);
  }
 /*
  * Clean up the temporary data used to run the tests.
  * This method is not intended to be called by clients, it will be called
  * automatically when the clients use a ReconcilerTestSuite.
  */
 public void cleanup() throws Exception {
   // rm -rf eclipse sub-dir
   boolean leaveDirty =
       Boolean.parseBoolean(TestActivator.getContext().getProperty("p2.tests.doNotClean"));
   if (leaveDirty) return;
   for (Iterator iter = toRemove.iterator(); iter.hasNext(); ) {
     File next = (File) iter.next();
     delete(next);
   }
   output = null;
   toRemove.clear();
 }