Package org.wikipediacleaner.api.data

Examples of org.wikipediacleaner.api.data.PageElementFunction$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

              nbCr++;
            }
            tmpIndex--;
          }
          PageElementTemplate template = analysis.isInTemplate(tmpIndex - 1);
          PageElementFunction function = analysis.isInFunction(tmpIndex - 1);
          if ((template != null) && (template.getEndIndex() == tmpIndex)) {
            replacement.append("\n\n");
            beginIndex = tmpIndex;
          } else if ((function != null) && (function.getEndIndex() == tmpIndex)) {
            if (function.getMagicWord().isPossibleAlias(MagicWord.DEFAULT_SORT)) {
              tmpIndex = function.getBeginIndex();
              while ((tmpIndex > 0) &&
                     ((contents.charAt(tmpIndex - 1) == ' ') ||
                      (contents.charAt(tmpIndex - 1) == '\n'))) {
                tmpIndex--;
              }
              replacement.append("\n\n");
              replacement.append(contents.substring(function.getBeginIndex(), function.getEndIndex()));
            }
            replacement.append("\n");
            beginIndex = tmpIndex;
          } else if (analysis.getPage().isRedirect() && (nbCr == 0)) {
            int crIndex = contents.indexOf('\n');
View Full Code Here

        if ((template != null) && (template.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementFunction function = analysis.isInFunction(currentIndex);
        if ((function != null) && (function.getEndIndex() == currentIndex + 2)) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if ((currentIndex + 2 < maxLength) &&
View Full Code Here

             (template.getBeginIndex() == currentIndex + 1))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        PageElementFunction function = analysis.isInFunction(currentIndex + 2);
        if ((function != null) &&
            ((function.getBeginIndex() == currentIndex) ||
             (function.getBeginIndex() == currentIndex + 1))) {
          shouldCount = false;
        }
      }
      if (shouldCount) {
        if ((currentIndex + 2 < maxLength) &&
View Full Code Here

      if (contents.charAt(tmpIndex) == '{') {
        PageElementTemplate template = analysis.isInTemplate(tmpIndex);
        if ((template != null) && (template.getBeginIndex() == tmpIndex)) {
          nextIndex = template.getEndIndex();
        } else {
          PageElementFunction function = analysis.isInFunction(tmpIndex);
          if ((function != null) && (function.getBeginIndex() == tmpIndex)) {
            nextIndex = function.getEndIndex();
          }
        }
      }
      if (!finished) {
        tmpIndex = nextIndex;
View Full Code Here

          }
        }

        // Check for functions
        if (!done) {
          PageElementFunction function = analysis.isInFunction(currentIndex);
          if ((function != null) &&
              (function.getBeginIndex() == currentIndex)) {
            MagicWord magicWord = function.getMagicWord();
            String magicWordName = magicWord.getName();
            boolean isOk = false;
            if (MagicWord.DEFAULT_SORT.equals(magicWordName) ||
                MagicWord.FORMAT_NUM.equals(magicWordName) ||
                MagicWord.DISPLAY_TITLE.equals(magicWordName)) {
              isOk = true;
            }
            if (!isOk &&
                MagicWord.TAG.equals(magicWordName) &&
                (function.getParameterCount() > 0) &&
                (PageElementTag.TAG_WIKI_REF.equals(function.getParameterValue(0)))) {
              isOk = true;
            }
            if (!isOk) {
              result = true;
              done = true;
              if (errors == null) {
                return true;
              }
              CheckErrorResult errorResult = createCheckErrorResult(
                  analysis, function.getBeginIndex(), function.getEndIndex());
              if (MagicWord.PAGE_NAME.equals(magicWordName)) {
                errorResult.addReplacement(page.getTitle());
              }
              if (MagicWord.IF_EXPR.equals(magicWordName)) {
                for (int param = 1; param < function.getParameterCount(); param++) {
                  errorResult.addReplacement(function.getParameterValue(param));
                }
              }
              if ((analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_GALLERY) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_INCLUDEONLY) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_REF) == null) &&
                  (analysis.isInTag(currentIndex, PageElementTag.TAG_WIKI_TIMELINE) == null)) {
                errorResult.addReplacement(
                    "{{subst:" +
                    contents.substring(function.getBeginIndex() + 2, function.getEndIndex()));
              }
              errors.add(errorResult);
              nextIndex = function.getEndIndex();
            } else {
              nextIndex = currentIndex + 2;
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.data.PageElementFunction$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.