Package org.wikipediacleaner.api.data

Examples of org.wikipediacleaner.api.data.PageElementImage$Parameter


                SampleOAuth2Provider.generateAccessAndRefreshToken(accessor);
                String redirect_uri = request.getParameter(OAuth2.REDIRECT_URI);
                String state = request.getParameter(OAuth2.STATE);
               
                List<Parameter> list = new ArrayList<Parameter>(5);
                list.add(new Parameter(OAuth2.ACCESS_TOKEN,accessor.accessToken));
                list.add(new Parameter(OAuth2.TOKEN_TYPE,accessor.tokenType));
                list.add(new Parameter(OAuth2.EXPIRES_IN,"3600"));
                if(accessor.scope!=null) list.add(new Parameter(OAuth2.SCOPE,accessor.scope));
                if(state != null){
                    list.add(new Parameter(OAuth2.STATE, state));
                }
               
                redirect_uri = OAuth2.addParametersAsFragment(redirect_uri,list);
                response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
                response.setHeader("Location", OAuth2.decodePercent(redirect_uri));
View Full Code Here


            // test number of parameters
            if (firstParameters.size() == secondParameters.size())
            {
                for (int i = 0; i < firstParameters.size() && sameSignature; i++)
                {
                    final Parameter firstParameter = (Parameter)firstParameters.get(i);
                    final Parameter secondParameter = (Parameter)secondParameters.get(i);

                    // test each parameter's type
                    sameSignature =
                        isEqual(
                            firstParameter.getType(),
                            secondParameter.getType());
                }
            }
            else
            {
                sameSignature = false;
View Full Code Here

        Iterator iterator = this.metaObject.getOwnedParameters().iterator();

        boolean commaNeeded = false;
        while (iterator.hasNext())
        {
            Parameter parameter = (Parameter)iterator.next();

            if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
            {
                if (commaNeeded)
                {
                    buffer.append(", ");
                }
                buffer.append(parameter.getName());
                commaNeeded = true;
            }
        }
        return buffer.toString();
    }
View Full Code Here

        Iterator iterator = this.metaObject.getOwnedParameters().iterator();

        boolean commaNeeded = false;
        while (iterator.hasNext())
        {
            Parameter parameter = (Parameter)iterator.next();

            if (!parameter.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL))
            {
                if (commaNeeded)
                {
                    buffer.append(", ");
                }
View Full Code Here

            arguments,
            new Predicate()
            {
                public boolean evaluate(final Object object)
                {
                    Parameter p = (Parameter)object;
                    return !p.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL) && !p.isException();
                }
            });
        return arguments;
    }
View Full Code Here

          }
        }

        // Limit error
        if (breakFound) {
          PageElementImage image = analysis.isInImage(currentPos);
          if (image != null) {
            breakFound = false;
          }
        }
View Full Code Here

        if ((link != null) && (link.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementImage image = analysis.isInImage(currentIndex);
        if ((image != null) && (image.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementCategory category = analysis.isInCategory(currentIndex);
        if ((category != null) && (category.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementLanguageLink link = analysis.isInLanguageLink(currentIndex);
        if ((link != null) && (link.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementInterwikiLink link = analysis.isInInterwikiLink(currentIndex);
        if ((link != null) && (link.getBeginIndex() == currentIndex)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementExternalLink link = analysis.isInExternalLink(currentIndex + 1);
        if ((link != null) && (link.getBeginIndex() == currentIndex + 1)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if ((analysis.isInComment(currentIndex) != null) ||
            (analysis.getSurroundingTag(PageElementTag.TAG_WIKI_NOWIKI, currentIndex) != null) ||
            (analysis.getSurroundingTag(PageElementTag.TAG_WIKI_MATH, currentIndex) != null) ||
            (analysis.getSurroundingTag(PageElementTag.TAG_WIKI_SCORE, currentIndex) != null) ||
            (analysis.getSurroundingTag(PageElementTag.TAG_WIKI_SOURCE, currentIndex) != null) ||
            (analysis.getSurroundingTag(PageElementTag.TAG_WIKI_SYNTAXHIGHLIGHT, currentIndex) != null) ||
            (analysis.isInTag(currentIndex) != null)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementTemplate template = analysis.isInTemplate(currentIndex + 2);
        if ((template != null) && (contents.startsWith("]]", template.getEndIndex()))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if (errors == null) {
          return true;
        }
        result = true;
       
        // Check if there is a potential end
        int tmpIndex = currentIndex + 2;
        boolean errorReported = false;
        boolean finished = false;
        while (!finished && (tmpIndex < maxLength)) {
          char tmpChar = contents.charAt(tmpIndex);
          if (REJECTED_CHARS.indexOf(tmpChar) >= 0) {
            finished = true;
          } else if (tmpChar == ']') {
            int tmpIndex2 = tmpIndex + 1;
            while ((tmpIndex2 < maxLength) &&
                   (contents.charAt(tmpIndex2) != ']') &&
                   (REJECTED_CHARS.indexOf(contents.charAt(tmpIndex2)) < 0)) {
              tmpIndex2++;
            }
            String suffix = "";
            if ((tmpIndex2 < maxLength) && (contents.charAt(tmpIndex2) == ']')) {
              suffix = contents.substring(tmpIndex + 1, tmpIndex2 + 1);
            } else {
              tmpIndex2 = tmpIndex;
            }
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, currentIndex, tmpIndex2 + 1);

            // Check if the situation is something like [[http://....] (replacement: [http://....])
            boolean protocolFound = PageElementExternalLink.isPossibleProtocol(contents, currentIndex + 2);
            if (protocolFound) {
              errorResult.addReplacement(contents.substring(currentIndex + 1, tmpIndex2 + 1));
            }

            errorResult.addReplacement(contents.substring(currentIndex, tmpIndex + 1) + "]" + suffix);
            if (suffix.length() > 0) {
              errorResult.addReplacement(contents.substring(currentIndex, tmpIndex) + suffix + "]");
            }
            errors.add(errorResult);
            errorReported = true;
            finished = true;
          } else if (tmpChar == '}') {
            int lastChar = tmpIndex;
            if ((lastChar + 1 < maxLength) && (contents.charAt(lastChar + 1) == '}')) {
              lastChar++;
            }
            CheckErrorResult errorResult = createCheckErrorResult(
                analysis, currentIndex, lastChar + 1);
            errorResult.addReplacement(contents.substring(currentIndex, tmpIndex) + "]]");
            errorResult.addReplacement("{{" + contents.substring(currentIndex + 2, tmpIndex) + "}}");
            errors.add(errorResult);
            errorReported = true;
            finished = true;
          }
          tmpIndex++;
        }

        // Default
        if (!errorReported) {
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, currentIndex, currentIndex + 2);
          errorResult.addReplacement("", GT._("Delete"));
          errors.add(errorResult);
        }
      }
      currentIndex = contents.indexOf("[[", currentIndex + 2);
    }

    // Analyze each internal link to see if it contains a [
    for (PageElementInternalLink link : analysis.getInternalLinks()) {
      String text = link.getText();
      if (text != null) {
        text = cleanText(text);
        if (text != null) {
          if (errors == null) {
            return true;
          }
          result = true;
          CheckErrorResult errorResult = createCheckErrorResult(
              analysis, link.getBeginIndex(), link.getEndIndex());
          errorResult.addReplacement(PageElementInternalLink.createInternalLink(
              link.getLink(), link.getAnchor(), text));
          errors.add(errorResult);
        }
      }
    }

    // Analyze each image to see if it contains a [
    for (PageElementImage image : analysis.getImages()) {
      String text = image.getDescription();
      String modifiedText = cleanText(text);
      String alt = image.getAlternateDescription();
      String modifiedAlt = cleanText(alt);
      if ((modifiedText != null) || (modifiedAlt != null)) {
        if (errors == null) {
          return true;
        }
        result = true;
        CheckErrorResult errorResult = createCheckErrorResult(
            analysis, image.getBeginIndex(), image.getEndIndex());
        errorResult.addReplacement(image.getDescriptionReplacement(
            (modifiedText != null) ? modifiedText : text,
            (modifiedAlt != null) ? modifiedAlt : alt));
        errors.add(errorResult);
      }
    }
View Full Code Here

      return createDefaultPopupInternalLink(textPane, position, pageAnalysis, internalLink);
    }

    // Menu for image
    if (element instanceof PageElementImage) {
      PageElementImage image = (PageElementImage) element;
      return createDefaultPopupImage(textPane, position, pageAnalysis, image);
    }

    // Menu for external link
    if (element instanceof PageElementExternalLink) {
View Full Code Here

             (link.getEndIndex() == currentIndex + 3))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementImage image = analysis.isInImage(currentIndex);
        if ((image != null) && (image.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementCategory category = analysis.isInCategory(currentIndex);
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.data.PageElementImage$Parameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.