Esempio n. 1
0
 protected int computeSerializedSize() {
   int j = super.computeSerializedSize();
   int i = j;
   if (a != null) {
     i = j + kwk.b(1, a);
   }
   j = i;
   if (b != null) {
     j = i + kwk.b(2, b);
   }
   i = j;
   if (c != null) {
     i = j + kwk.b(3, c);
   }
   j = i;
   if (d != null) {
     d.booleanValue();
     j = i + (kwk.f(5) + 1);
   }
   i = j;
   if (e != null) {
     e.booleanValue();
     i = j + (kwk.f(6) + 1);
   }
   return i;
 }
  public boolean hasWriteAccess() {
    if (myHasWriteAccess != null) return myHasWriteAccess.booleanValue();

    myFile.accept(
        new GroovyRecursiveElementVisitor() {
          @Override
          public void visitAssignmentExpression(GrAssignmentExpression expression) {
            if (isRefToMe(expression.getLValue())) {
              myHasWriteAccess = true;
            }
            super.visitAssignmentExpression(expression);
          }

          @Override
          public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
            // don't go inside type definitions
          }

          @Override
          public void visitElement(GroovyPsiElement element) {
            if (myHasWriteAccess == null) {
              super.visitElement(element);
            }
          }
        });

    if (myHasWriteAccess == null) myHasWriteAccess = false;
    return myHasWriteAccess.booleanValue();
  }
Esempio n. 3
0
  /** Type is the character command that toggles footprint visiblity */
  public void mySetType(String type) {
    final SequenceEncoder.Decoder st = new SequenceEncoder.Decoder(type, ';');
    st.nextToken();

    trailKey = st.nextKeyStroke(DEFAULT_TRAIL_KEY);
    menuCommand = st.nextToken(DEFAULT_MENU_COMMAND);
    initiallyVisible = st.nextBoolean(DEFAULT_INITIALLY_VISIBLE.booleanValue());
    globallyVisible = st.nextBoolean(DEFAULT_GLOBALLY_VISIBLE.booleanValue());
    circleRadius = st.nextInt(DEFAULT_CIRCLE_RADIUS);
    fillColor = st.nextColor(DEFAULT_FILL_COLOR);
    lineColor = st.nextColor(DEFAULT_LINE_COLOR);
    selectedTransparency = st.nextInt(DEFAULT_SELECTED_TRANSPARENCY);
    unSelectedTransparency = st.nextInt(DEFULT_UNSELECTED_TRANSPARENCY);
    edgePointBuffer = st.nextInt(DEFAULT_EDGE_POINT_BUFFER);
    edgeDisplayBuffer = st.nextInt(DEFAULT_EDGE_DISPLAY_BUFFER);
    lineWidth = st.nextDouble(LINE_WIDTH);

    commands = null;
    showTrailCommand = null;

    if (initiallyVisible) {
      localVisibility = true;
      globalVisibility = true;
    }
  }
  /** {@inheritDoc} */
  protected ValidatorError processFormValues(
      HttpServletRequest request, DynaActionForm form, BaseKickstartCommand cmd) {

    ValidatorError retval = null;

    KickstartLocaleCommand localeCmd = (KickstartLocaleCommand) cmd;
    cmd = null;

    ArrayList validTimezones = localeCmd.getValidTimezones();
    if (isTimezoneValid(validTimezones, form.getString(TIMEZONE)) == Boolean.TRUE) {
      localeCmd.setTimezone(form.getString(TIMEZONE));
    } else {
      retval = new ValidatorError("kickstart.locale." + "validation.timezone.invalid");
    }

    Boolean useUtc = (Boolean) form.get(USE_UTC);

    if (useUtc == null) {
      useUtc = Boolean.FALSE;
    }

    if (localeCmd.getKickstartData().isUsingUtc().booleanValue() && !useUtc.booleanValue()) {
      localeCmd.doNotUseUtc();
    } else if (!localeCmd.getKickstartData().isUsingUtc().booleanValue() && useUtc.booleanValue()) {
      localeCmd.useUtc();
    }

    return retval;
  }
  /** {@inheritDoc} */
  @Override
  public Surface<T> build() {
    surface = new SurfaceImpl<T>();

    if (cornerClickRadius == UNSET) {
      throw new IllegalStateException("Corner click radius unset. (reasonable value is 3)");
    } else {
      surface.setCornerClickRadius(cornerClickRadius);
    }
    if (dividerSize == UNSET) {
      throw new IllegalStateException("Divider size unset. (reasonable value is 10)");
    } else {
      surface.setDividerSize(dividerSize);
    }

    if (snapDistance != UNSET) {
      surface.setSnapDistance(snapDistance);
    }

    if (useIntegerPrecision != null) {
      surface.setUseIntegerPrecision(useIntegerPrecision.booleanValue());
    }
    if (useSurfaceOffset != null && useSurfaceOffset && surfaceOffset != null) {
      surface.setUseSurfaceOffset(useSurfaceOffset.booleanValue());
      surface.setSurfaceOffset(surfaceOffset);
    } else if (useSurfaceOffset != null && useSurfaceOffset && surfaceOffset == null) {
      throw new IllegalStateException(
          "There must be a surface offset to use if useSurfaceOffset is set to \"true\"");
    } else if (surfaceOffset != null && useSurfaceOffset != null && useSurfaceOffset) {
      System.err.println(
          "Warning surfaceOffset was set but the flag useSurfaceOffset was never set to true so it will remain unused");
    }

    return surface;
  }
Esempio n. 6
0
 /**
  * Parse a Mediawiki HTML link of the form "[http://www.site.com/ text]" or "http://www.site.com/"
  * and return the resulting HTML output.
  */
 public String parse(JFlexLexer lexer, String raw, Object... args) throws ParserException {
   if (logger.isTraceEnabled()) {
     logger.trace("htmllink: " + raw + " (" + lexer.yystate() + ")");
   }
   if (raw == null || StringUtils.isBlank(raw)) {
     // no link to display
     return raw;
   }
   boolean numberedCaption =
       (Environment.getBooleanValue(Environment.PROP_PARSER_USE_NUMBERED_HTML_LINKS)
           && args != null
           && args.length >= 1
           && ((Boolean) args[0]).booleanValue());
   Boolean linkCaption =
       (Boolean) lexer.getParserInput().getTempParams().get(WikiLinkTag.LINK_CAPTION);
   Boolean htmlLinkCaption =
       (Boolean) lexer.getParserInput().getTempParams().get(HTML_LINK_CAPTION);
   if ((linkCaption != null && linkCaption.booleanValue())
       || (htmlLinkCaption != null && htmlLinkCaption.booleanValue())) {
     // do not parse HTML tags in link captions as that would result in HTML of the form
     // "<a href="">this is the <a href="">link caption</a></a>"
     return raw;
   }
   return this.buildHtmlLinkRaw(
       lexer.getParserInput(), lexer.getParserOutput(), lexer.getMode(), raw, numberedCaption);
 }
    @Override
    public void setValueAt(Object arg0, int row, int col) {
      switch (col) {
        case 0:
          throw new PrimaryError("DupaDupaDupa");
        case 1:
          Boolean B = (Boolean) arg0;
          bools.set(row, B);
          if (row == printedNameOffset && !B.booleanValue()) {
            for (int i = 0; i < bools.size(); i++) {
              if (bools.get(i).booleanValue()) {
                printedNameOffset = i;
                this.fireTableDataChanged();
              }
            }
          }
          if (B.booleanValue() && !bools.get(printedNameOffset)) {
            printedNameOffset = row;
            this.fireTableDataChanged();
          }

        case 2:
          if (bools.get(row).booleanValue()) {
            printedNameOffset = row;
            this.fireTableDataChanged();
          }

          // default : throw new PrimaryError("DupaDupaDupa " + col);

      }
    }
  @Test
  @Transactional
  public void getAllFuncionarios() throws Exception {
    // Initialize the database
    Funcionario funcionario = funcionarioService.save(funcionarioDTO, "");
    funcionarioDTO.setId(funcionario.getId());

    // Get all the funcionarios
    restFuncionarioMockMvc
        .perform(get("/api/funcionarios"))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.[*].id").value(hasItem(funcionarioDTO.getId().intValue())))
        .andExpect(jsonPath("$.[*].nome").value(hasItem(DEFAULT_NOME.toString())))
        .andExpect(jsonPath("$.[*].cpf").value(hasItem(DEFAULT_CPF.toString())))
        .andExpect(jsonPath("$.[*].sexo").value(hasItem(DEFAULT_SEXO.toString())))
        .andExpect(jsonPath("$.[*].dataNascimento").value(hasItem(DEFAULT_DATA_NASCIMENTO_STR)))
        .andExpect(jsonPath("$.[*].email").value(hasItem(DEFAULT_EMAIL.toString())))
        .andExpect(jsonPath("$.[*].senha").value(hasItem(DEFAULT_SENHA.toString())))
        .andExpect(jsonPath("$.[*].ativo").value(hasItem(DEFAULT_ATIVO.booleanValue())))
        .andExpect(jsonPath("$.[*].numero").value(hasItem(DEFAULT_NUMERO)))
        .andExpect(jsonPath("$.[*].complemento").value(hasItem(DEFAULT_COMPLEMENTO.toString())))
        .andExpect(
            jsonPath("$.[*].responsavel").value(hasItem(DEFAULT_RESPONSAVEL.booleanValue())));
  }
Esempio n. 9
0
  /**
   * Restores a maximized window back to its original size and position prior to being maximized and
   * also replaces the 'restore' tool button with the 'maximize' tool button.
   */
  public void restore() {
    if (maximized) {
      el().removeStyleName("x-window-maximized");
      if (maximizable) {
        restoreBtn.setVisible(false);
        maxBtn.setVisible(true);
      }
      if (restoreShadow != null && restoreShadow.booleanValue() && layer != null) {
        layer.enableShadow();
        restoreShadow = null;
      }
      if (draggable) {
        dragger.setEnabled(true);
      }
      if (resizable) {
        resizer.setEnabled(true);
      }
      head.addStyleName("x-window-draggable");
      if (restorePos != null) {
        setPosition(restorePos.x, restorePos.y);

        boolean cacheSizesRestore = cacheSizes;
        cacheSizes = false;
        setSize(restoreSize.width, restoreSize.height);
        cacheSizes = cacheSizesRestore;
      }
      if (container == null && restoreWindowScrolling != null) {
        com.google.gwt.dom.client.Document.get()
            .enableScrolling(restoreWindowScrolling.booleanValue());
        restoreWindowScrolling = null;
      }
      maximized = false;
      fireEvent(Events.Restore, new WindowEvent(this));
    }
  }
Esempio n. 10
0
  /**
   * Configures the socket for use
   *
   * @param sock
   * @throws SocketException, IllegalArgumentException if setting the options on the socket failed.
   */
  protected void initialiseSocket(Socket sock) throws SocketException, IllegalArgumentException {
    if (socketOptions != null) {
      IntrospectionSupport.setProperties(socket, socketOptions);
    }

    try {
      sock.setReceiveBufferSize(socketBufferSize);
      sock.setSendBufferSize(socketBufferSize);
    } catch (SocketException se) {
      LOG.warn("Cannot set socket buffer size = " + socketBufferSize);
      LOG.debug("Cannot set socket buffer size. Reason: " + se, se);
    }
    sock.setSoTimeout(soTimeout);

    if (keepAlive != null) {
      sock.setKeepAlive(keepAlive.booleanValue());
    }

    if (soLinger > -1) {
      sock.setSoLinger(true, soLinger);
    } else if (soLinger == -1) {
      sock.setSoLinger(false, 0);
    }
    if (tcpNoDelay != null) {
      sock.setTcpNoDelay(tcpNoDelay.booleanValue());
    }
    if (!this.trafficClassSet) {
      this.trafficClassSet = setTrafficClass(sock);
    }
  }
Esempio n. 11
0
  private void isMapClick(
      final String imgId,
      final Boolean samePage,
      final String urlSuffixClick,
      final String urlSuffixClickXY)
      throws Exception {

    final String htmlContent =
        "<html><head><title>foo</title></head><body>\n"
            + "<a href='http://server/foo'>\n"
            + "<img id='img1' src='foo.png' ismap>\n"
            + "<img id='img2' src='foo.png'>\n"
            + "</a>\n"
            + "<img id='img3' src='foo.png' ismap>\n"
            + "<img id='img4' src='foo.png'>\n"
            + "</body></html>";
    final HtmlPage page = loadPage(htmlContent);

    final HtmlImage img = page.getHtmlElementById(imgId);

    final Page page2 = img.click();
    Assert.assertEquals("same page after click", samePage, Boolean.valueOf(page == page2));
    if (!samePage.booleanValue()) {
      assertEquals(
          "http://server/foo" + urlSuffixClick, page2.getWebResponse().getWebRequest().getUrl());
    }

    final Page page3 = img.click(25, 30);
    Assert.assertEquals("same page after click(25, 30)", samePage, Boolean.valueOf(page == page3));
    if (!samePage.booleanValue()) {
      assertEquals(
          "http://server/foo" + urlSuffixClickXY, page3.getWebResponse().getWebRequest().getUrl());
    }
  }
Esempio n. 12
0
  public void execute(Connection connection) {
    Boolean storedAutoCommit = null;
    try {
      storedAutoCommit = Boolean.valueOf(connection.getAutoCommit());
      if (storedAutoCommit.booleanValue() == true) {
        setAutoCommit(connection, false);
      }

      TransactionConnection transactionConnection = transactionConnection(connection);
      defaultTransactionBody(transactionConnection);

      if (!abortted && !transactionConnection.isAborted()) {
        commitTransaction(connection);
      } else {
        rollback(connection);
      }
    } catch (SQLException e) {
      rollback(connection);
      throw new SQLSystemException("Error executing transaction.  Rolledback", e);
    } catch (RuntimeException e) {
      rollback(connection);
      throw e;
    } catch (Exception e) {
      rollback(connection);
      throw new SystemException("Error executing transaction.  Rolledback", e);
    } finally {
      if (storedAutoCommit != null) {
        setAutoCommit(connection, storedAutoCommit.booleanValue());
      }
    }
  }
Esempio n. 13
0
 private AgentOptions createAgentOptions() {
   final AgentOptions agentOptions = new AgentOptions();
   final String destPath = destFile.getAbsolutePath();
   agentOptions.setDestfile(destPath);
   if (append != null) {
     agentOptions.setAppend(append.booleanValue());
   }
   if (getIncludes() != null && !getIncludes().isEmpty()) {
     String agentIncludes = StringUtils.join(getIncludes().iterator(), ":");
     agentOptions.setIncludes(agentIncludes);
   }
   if (getExcludes() != null && !getExcludes().isEmpty()) {
     String agentExcludes = StringUtils.join(getExcludes().iterator(), ":");
     agentOptions.setExcludes(agentExcludes);
   }
   if (exclClassLoaders != null) {
     agentOptions.setExclClassloader(exclClassLoaders);
   }
   if (sessionId != null) {
     agentOptions.setSessionId(sessionId);
   }
   if (dumpOnExit != null) {
     agentOptions.setDumpOnExit(dumpOnExit.booleanValue());
   }
   if (output != null) {
     agentOptions.setOutput(output);
   }
   if (address != null) {
     agentOptions.setAddress(address);
   }
   if (port != null) {
     agentOptions.setPort(port.intValue());
   }
   return agentOptions;
 }
  @Override
  public void passivateObject(PooledObject<PoolableConnection> p) throws Exception {

    validateLifetime(p);

    PoolableConnection conn = p.getObject();
    Boolean connAutoCommit = null;
    if (rollbackOnReturn) {
      connAutoCommit = Boolean.valueOf(conn.getAutoCommit());
      if (!connAutoCommit.booleanValue() && !conn.isReadOnly()) {
        conn.rollback();
      }
    }

    conn.clearWarnings();

    // DBCP-97 / DBCP-399 / DBCP-351 Idle connections in the pool should
    // have autoCommit enabled
    if (enableAutoCommitOnReturn) {
      if (connAutoCommit == null) {
        connAutoCommit = Boolean.valueOf(conn.getAutoCommit());
      }
      if (!connAutoCommit.booleanValue()) {
        conn.setAutoCommit(true);
      }
    }

    conn.passivate();
  }
 private void q()
 {
   for (;;)
   {
     try
     {
       if ((ac.a() >= 8) && (h != null))
       {
         bool = i.booleanValue();
         if (bool) {
           continue;
         }
       }
     }
     catch (Exception localException)
     {
       continue;
       boolean bool = false;
       continue;
     }
     finally {}
     return;
     synchronized (V)
     {
       if (i.booleanValue())
       {
         if (h.b()) {
           continue;
         }
         bool = true;
         i = Boolean.valueOf(bool);
       }
     }
   }
 }
 public void testBoolean() {
   Boolean bool;
   bool = true;
   assertTrue("BooleanTrue", bool.booleanValue());
   bool = false;
   assertFalse("BooleanFalse", bool.booleanValue());
 }
Esempio n. 17
0
  /* (non-Javadoc)
   * @see de.enough.polish.ui.ContainerView#setStyle(de.enough.polish.ui.Style)
   */
  protected void setStyle(Style style) {
    super.setStyle(style);
    // #if polish.css.fisheyeview-remove-text
    Boolean removeTextBool = style.getBooleanProperty("fisheyeview-remove-text");
    if (removeTextBool != null) {
      this.isRemoveText = removeTextBool.booleanValue();
    }
    // #endif

    // #if polish.css.fisheyeview-scale && polish.midp2
    Integer scaleInt = style.getIntProperty("fisheyeview-scale");
    if (scaleInt != null) {
      this.scaleFactorWidth = scaleInt.intValue();
    }
    // #endif
    // #if polish.css.show-text-in-title
    Boolean showTextInTitleBool = style.getBooleanProperty("show-text-in-title");
    if (showTextInTitleBool != null) {
      this.isShowTextInTitle = showTextInTitleBool.booleanValue();
      if (this.isShowTextInTitle) {
        this.isRemoveText = true;
      }
    }
    // #endif
    // #if polish.css.fisheyeview-max-visible
    Integer maxVisibleItemsInt = style.getIntProperty("fisheyeview-max-visible");
    if (maxVisibleItemsInt != null) {
      this.maxVisibleItems = maxVisibleItemsInt.intValue();
    }
    // #endif

  }
Esempio n. 18
0
  /**
   * @return true, if the element contains a reference to a different class than fullyQualifiedName
   *     but which has the same class name
   */
  public static boolean containsConflictingReference(PsiFile element, String fullyQualifiedName) {
    final Map<String, Boolean> cachedValue =
        CachedValuesManager.getManager(element.getProject())
            .getCachedValue(
                element,
                new CachedValueProvider<Map<String, Boolean>>() {
                  @Nullable
                  @Override
                  public Result<Map<String, Boolean>> compute() {
                    return new Result<Map<String, Boolean>>(
                        Collections.synchronizedMap(new HashMap<String, Boolean>()),
                        PsiModificationTracker.MODIFICATION_COUNT);
                  }
                });
    Boolean conflictingRef = cachedValue.get(fullyQualifiedName);
    if (conflictingRef != null) {
      return conflictingRef.booleanValue();
    }

    final ConflictingClassReferenceVisitor visitor =
        new ConflictingClassReferenceVisitor(fullyQualifiedName);
    element.accept(visitor);
    conflictingRef = visitor.isConflictingReferenceFound();
    cachedValue.put(fullyQualifiedName, conflictingRef);

    return conflictingRef.booleanValue();
  }
 /**
  * Checks whether the command is available and can be started.
  *
  * <p><em>Implementation detail:</em> This is lazily detected once and then cached.
  *
  * @return <code>true</code> if it is available and executable, <code>false</code> otherwise
  * @see #COMMAND
  */
 public static synchronized boolean isAvailable() {
   if (available != null) {
     return available.booleanValue();
   }
   checkIsAvailableAndGetVersion();
   return available.booleanValue();
 }
Esempio n. 20
0
  /**
   * Verifies that the result of the SNMP query meets the criteria specified by the operator and the
   * operand from the configuration file.
   *
   * @param result a {@link org.opennms.netmgt.snmp.SnmpValue} object.
   * @param operator a {@link java.lang.String} object.
   * @param operand a {@link java.lang.String} object.
   * @return a boolean.
   */
  protected boolean meetsCriteria(SnmpValue result, String operator, String operand) {

    Boolean retVal = null;

    retVal = isCriteriaNull(result, operator, operand);

    if (retVal == null) {
      String value = result.toString();
      retVal = checkStringCriteria(operator, operand, value);

      if (retVal == null) {
        BigInteger val = BigInteger.valueOf(result.toLong());

        BigInteger intOperand = new BigInteger(operand);
        if (LESS_THAN.equals(operator)) {
          return val.compareTo(intOperand) < 0;
        } else if (LESS_THAN_EQUALS.equals(operator)) {
          return val.compareTo(intOperand) <= 0;
        } else if (GREATER_THAN.equals(operator)) {
          return val.compareTo(intOperand) > 0;
        } else if (GREATER_THAN_EQUALS.equals(operator)) {
          return val.compareTo(intOperand) >= 0;
        } else {
          throw new IllegalArgumentException("operator " + operator + " is unknown");
        }
      }
    } else if (retVal.booleanValue()) {
      return true;
    }

    return retVal.booleanValue();
  }
 public void a(lxz paramlxz) {
   int i1 = 0;
   if (a != null) {
     paramlxz.a(1, a.booleanValue());
   }
   if (b != null) {
     paramlxz.a(2, b.intValue());
   }
   if (e != null) {
     paramlxz.a(3, e.booleanValue());
   }
   if (f != null) {
     paramlxz.a(4, f.booleanValue());
   }
   if (k != null) {
     paramlxz.b(5, k.longValue());
   }
   if (h != null) {
     paramlxz.a(6, h.intValue());
   }
   if (i != null) {
     paramlxz.a(7, i.booleanValue());
   }
   if (c != null) {
     paramlxz.b(8, c.longValue());
   }
   if (d != null) {
     paramlxz.a(9, d);
   }
   int n;
   Object localObject;
   if ((j != null) && (j.length > 0)) {
     n = 0;
     while (n < j.length) {
       localObject = j[n];
       if (localObject != null) {
         paramlxz.b(10, (lyi) localObject);
       }
       n += 1;
     }
   }
   if (l != null) {
     paramlxz.b(11, l);
   }
   if (m != null) {
     paramlxz.a(12, m.booleanValue());
   }
   if ((g != null) && (g.length > 0)) {
     n = i1;
     while (n < g.length) {
       localObject = g[n];
       if (localObject != null) {
         paramlxz.b(13, (lyi) localObject);
       }
       n += 1;
     }
   }
   super.a(paramlxz);
 }
Esempio n. 22
0
 /** Return the value of the <code>partialSubmitOnBlur</code> property. */
 public boolean getPartialSubmitOnBlur() {
   if (partialSubmitOnBlur != null) {
     return partialSubmitOnBlur.booleanValue();
   }
   ValueBinding vb = getValueBinding("partialSubmitOnBlur");
   Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
   return boolVal != null ? boolVal.booleanValue() : false;
 }
Esempio n. 23
0
 /** Return the value of the <code>partialSubmit</code> property. */
 public boolean getPartialSubmit() {
   if (partialSubmit != null) {
     return partialSubmit.booleanValue();
   }
   ValueBinding vb = getValueBinding("partialSubmit");
   Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
   return boolVal != null ? boolVal.booleanValue() : Util.isParentPartialSubmit(this);
 }
Esempio n. 24
0
 /** Return the value of the <code>visible</code> property. */
 public boolean getVisible() {
   if (visible != null) {
     return visible.booleanValue();
   }
   ValueBinding vb = getValueBinding("visible");
   Boolean boolVal = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
   return boolVal != null ? boolVal.booleanValue() : DEFAULT_VISIBLE;
 }
Esempio n. 25
0
 public void testCPPBoolean(Boolean a, Boolean b, Boolean c, Boolean d, Boolean e) {
   if (b && b.booleanValue()) {
     System.out.println("Booya");
   }
   if (e && e.booleanValue()) {
     System.out.println("Booya");
   }
 }
Esempio n. 26
0
 public void set(Boolean e) {
   if (lastRemoved) throw new IllegalStateException("set() cannot be called after remove()");
   if (get(theIndex) != theContent[theIndex])
     throw new java.util.ConcurrentModificationException(
         "List has been modified apart from this iterator");
   theContent[theIndex] = e.booleanValue();
   BooleanList.this.set(theIndex, e.booleanValue());
 }
  public DLFileShortcut addFileShortcut(
      String uuid,
      long userId,
      long folderId,
      long toFolderId,
      String toName,
      Boolean addCommunityPermissions,
      Boolean addGuestPermissions,
      String[] communityPermissions,
      String[] guestPermissions)
      throws PortalException, SystemException {

    // File shortcut

    User user = userPersistence.findByPrimaryKey(userId);
    folderId = getFolderId(user.getCompanyId(), folderId);
    DLFolder folder = dlFolderPersistence.findByPrimaryKey(folderId);
    Date now = new Date();

    validate(user, toFolderId, toName);

    long fileShortcutId = counterLocalService.increment();

    DLFileShortcut fileShortcut = dlFileShortcutPersistence.create(fileShortcutId);

    fileShortcut.setUuid(uuid);
    fileShortcut.setCompanyId(user.getCompanyId());
    fileShortcut.setUserId(user.getUserId());
    fileShortcut.setUserName(user.getFullName());
    fileShortcut.setCreateDate(now);
    fileShortcut.setModifiedDate(now);
    fileShortcut.setFolderId(folderId);
    fileShortcut.setToFolderId(toFolderId);
    fileShortcut.setToName(toName);

    dlFileShortcutPersistence.update(fileShortcut);

    // Resources

    if ((addCommunityPermissions != null) && (addGuestPermissions != null)) {

      addFileShortcutResources(
          folder,
          fileShortcut,
          addCommunityPermissions.booleanValue(),
          addGuestPermissions.booleanValue());
    } else {
      addFileShortcutResources(folder, fileShortcut, communityPermissions, guestPermissions);
    }

    // Folder

    folder.setLastPostDate(fileShortcut.getModifiedDate());

    dlFolderPersistence.update(folder);

    return fileShortcut;
  }
Esempio n. 28
0
  public void setParameters(Map params) throws GeoprocessException {
    Boolean firstLayerSelection = (Boolean) params.get("firstlayerselection");
    if (firstLayerSelection != null)
      this.onlyFirstLayerSelection = firstLayerSelection.booleanValue();

    Boolean secondLayerSelection = (Boolean) params.get("secondlayerselection");
    if (secondLayerSelection != null)
      this.onlyClipLayerSelection = secondLayerSelection.booleanValue();
  }
Esempio n. 29
0
  /**
   * Construct a new instance and configure it.
   *
   * @param broker
   * @param conf
   */
  public TextSearchEngine(DBBroker broker, Configuration conf) {
    this.broker = broker;
    this.config = conf;
    String stopword, tokenizerClass;
    Boolean num, stemming, termFrequencies;
    if ((num = (Boolean) config.getProperty(PROPERTY_INDEX_NUMBERS)) != null)
      indexNumbers = num.booleanValue();
    if ((stemming = (Boolean) config.getProperty(PROPERTY_STEM)) != null)
      stem = stemming.booleanValue();
    if ((termFrequencies = (Boolean) config.getProperty(PROPERTY_STORE_TERM_FREQUENCY)) != null)
      termFreq = termFrequencies.booleanValue();
    String track = (String) config.getProperty(Serializer.PROPERTY_TAG_MATCHING_ELEMENTS);
    if (track != null)
      trackMatches =
          track.equalsIgnoreCase("yes") ? Serializer.TAG_ELEMENT_MATCHES : Serializer.TAG_NONE;
    track = (String) config.getProperty(Serializer.PROPERTY_TAG_MATCHING_ATTRIBUTES);
    if (track != null && track.equalsIgnoreCase("yes"))
      trackMatches = trackMatches | Serializer.TAG_ATTRIBUTE_MATCHES;

    if ((tokenizerClass = (String) config.getProperty(PROPERTY_TOKENIZER)) != null) {
      try {
        Class tokClass = Class.forName(tokenizerClass);
        tokenizer = (Tokenizer) tokClass.newInstance();
        LOG.debug("using tokenizer: " + tokenizerClass);
      } catch (ClassNotFoundException e) {
        LOG.debug(e);
      } catch (InstantiationException e) {
        LOG.debug(e);
      } catch (IllegalAccessException e) {
        LOG.debug(e);
      }
    }
    if (tokenizer == null) {
      LOG.debug("using simple tokenizer");
      tokenizer = new SimpleTokenizer();
    }

    if (stem) stemmer = new PorterStemmer();
    tokenizer.setStemming(stem);
    if ((stopword = (String) config.getProperty(PROPERTY_STOPWORD_FILE)) != null) {
      try {
        FileReader in = new FileReader(stopword);
        StreamTokenizer tok = new StreamTokenizer(in);
        int next = tok.nextToken();
        while (next != StreamTokenizer.TT_EOF) {
          if (next != StreamTokenizer.TT_WORD) continue;
          stoplist.add(tok.sval);
          next = tok.nextToken();
        }
      } catch (FileNotFoundException e) {
        LOG.debug(e);
      } catch (IOException e) {
        LOG.debug(e);
      }
    }
  }
Esempio n. 30
0
  /////////////////////////////////////////////////////////////
  //
  // OUTPUT PARAMETER METHODS
  //
  /////////////////////////////////////////////////////////////
  public static void testNull(Boolean passedInNull, Boolean setToNull, Integer[] retval)
      throws Throwable {
    if (passedInNull.booleanValue()) {
      if (retval[0] != null) {
        throw new Throwable("testNull() got a non-null param when it should have been null");
      }
    }

    retval[0] = (setToNull.booleanValue()) ? null : new Integer((short) 66);
  }