示例#1
0
  private PropertyDescriptor getPropertyDescriptor(Class objClass, String property)
      throws IntrospectionException {
    synchronized (m_descriptorMapLock) {
      Map<String, PropertyDescriptor> propMap = m_descriptorMap.get(objClass);

      if (propMap == null) {
        propMap = new HashMap<String, PropertyDescriptor>();
        m_descriptorMap.put(objClass, propMap);

        BeanInfo beanInfo = Introspector.getBeanInfo(objClass);
        PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor descriptor : descriptors) {
          propMap.put(getUnderscorePropertyName(descriptor.getName()), descriptor);
        }
      }

      return (propMap.get(property));
    }
  }
  public void generate(String inputFileName) throws Exception {
    List<MetaClass> metaClasses = new ArrayList<>();
    List<LifeLine> lifeLines = new ArrayList<>();
    List<MethodInvocation> rootMessages = new ArrayList<>();
    MethodInvocation parentMessage = new MethodInvocation();
    GsonBuilder builder = new GsonBuilder();
    List<MethodInvocation> methodInvocations = new ArrayList<>();
    Package mainPackage = new Package();
    List<Guard> listOfGuards = new ArrayList<>();
    Map<Guard, Instruction> guardToCFMap = new HashMap<>();
    List<Instruction> combinedFragments = new ArrayList<Instruction>();
    List<Operation> operationsList = new ArrayList<>();

    builder.registerTypeAdapter(RefObject.class, new RefObjectJsonDeSerializer());
    Gson gson = builder.create();

    Element myTypes = gson.fromJson(new FileReader(inputFileName), Element.class);
    if (myTypes._type.equals("Project")) {
      List<Element> umlElements =
          myTypes
              .ownedElements
              .stream()
              .filter(f -> f._type.equals("UMLModel"))
              .collect(Collectors.toList());
      if (umlElements.size() > 0) { // There has be to atleast one UMLModel package
        Element element = umlElements.get(0);
        // package that the classes are supposed to be in
        mainPackage.setName(element.name);
        List<Element> umlPackages =
            element
                .ownedElements
                .stream()
                .filter(g -> g._type.equals("UMLPackage"))
                .collect(Collectors.toList());
        if (umlPackages.size()
            > 1) { // There has to be two packages- one for class one for behaviour
          Element classes = umlPackages.get(0);
          Element behaviour = umlPackages.get(1);
          // *--------------------------CLASSES-------------------------------*//
          // in the first pass, get all classes that are defined in the diagram
          // get details that can be directly inferred from the json like, fields and operations,
          // which do not refer to other classes
          for (Element umlClass : classes.getOwnedElements()) {
            MetaClass metaClass = new MetaClass(umlClass.name, umlClass._id);

            // check if class is interface or not because there is no distinction in json
            if (umlClass._type.equals("UMLClass")) {
              metaClass.setInterface(false);
            } else {
              metaClass.setInterface(true);
            }
            if (umlClass.operations != null) {
              metaClass.setOperations(umlClass.operations);
              operationsList.addAll(metaClass.operations);
            }
            if (umlClass.attributes != null) {
              metaClass.setFields(umlClass.attributes);
            }
            metaClasses.add(metaClass);
          }

          // in second pass, define associations and generalizations for these classes
          for (Element umlClass : classes.getOwnedElements()) {
            if (umlClass.ownedElements != null) {
              // find corresponding metaclass, then populate the secondary inferences
              List<MetaClass> correspondingMetaClassList =
                  metaClasses
                      .stream()
                      .filter(f -> f._id.equals(umlClass._id))
                      .collect(Collectors.toList());
              MetaClass correspondingMetaClass = correspondingMetaClassList.get(0);
              List<Element> umlAssociations =
                  umlClass
                      .ownedElements
                      .stream()
                      .filter(f -> f._type.equals("UMLAssociation"))
                      .collect(Collectors.toList());

              if (umlAssociations.size() > 0) {
                correspondingMetaClass.setAssociations(metaClasses, umlAssociations);
              }
              List<Element> umlGeneralization =
                  umlClass
                      .ownedElements
                      .stream()
                      .filter(f -> f._type.equals("UMLGeneralization"))
                      .collect(Collectors.toList());
              if (umlGeneralization.size() > 0) {
                correspondingMetaClass.setGeneralizations(metaClasses, umlGeneralization);
              }
              List<Element> umlRealization =
                  umlClass
                      .ownedElements
                      .stream()
                      .filter(f -> f._type.equals("UMLInterfaceRealization"))
                      .collect(Collectors.toList());
              if (umlRealization.size() > 0) {
                correspondingMetaClass.setInterfaceRealization(metaClasses, umlRealization);
              }
            }
          }

          // *--------------------------CLASSES-------------------------------*//

          // *-----------------------  BEHAVIOUR---------------------------------*//
          for (Element umlCollaboration : behaviour.getOwnedElements()) {
            // Role to Class mapping
            ArrayList<Element> attributes = umlCollaboration.attributes;
            HashMap<String, MetaClass> roleToClassMap = new HashMap<>();
            if (attributes != null) {
              for (Element attribute : attributes) {
                List<MetaClass> roleClass =
                    metaClasses
                        .stream()
                        .filter(f -> f._id.equals(attribute.type.$ref))
                        .collect(Collectors.toList());
                roleToClassMap.put(attribute._id, roleClass.get(0));
              }
            }

            for (Element umlInteraction : umlCollaboration.ownedElements) {

              // mapping lifelines to the classes they correspond
              ArrayList<Element> participants = umlInteraction.participants;
              if (participants != null && participants.size() > 0) {
                for (Element participant : participants) {
                  MetaClass participantClass = roleToClassMap.get(participant.represent.$ref);
                  LifeLine lifeLine = new LifeLine();
                  lifeLine.setName(participant.name);
                  lifeLine.setId(participant._id);
                  lifeLine.setMetaClass(participantClass);
                  lifeLines.add(lifeLine);
                }
              }
              // first parse all the combined fragments and get ready
              if (umlInteraction.fragments != null) {
                for (Element fragment :
                    umlInteraction.fragments) { // depending on the fragment set the class
                  Instruction instruction = null;
                  if (fragment.interactionOperator.equals("loop")) {
                    Loop loop = new Loop();
                    loop.setId(fragment._id);
                    loop.setWeight(0);
                    Guard guard = new Guard(fragment.operands.get(0)._id);
                    // loop can have only one condition--- one condition-- condition is made up of
                    // AND or OR's
                    guard.setCondition(fragment.operands.get(0).guard);
                    loop.setGuard(guard);
                    instruction = loop;
                    combinedFragments.add(loop);
                    listOfGuards.add(guard);
                    guardToCFMap.put(guard, loop);
                  }

                  if (fragment.interactionOperator.equals("alt")) {
                    Conditional c = new Conditional();
                    c.setId(fragment._id);
                    c.setWeight(0);
                    instruction = c;
                    combinedFragments.add(c);

                    Guard consequence = new Guard(fragment.operands.get(0)._id);
                    consequence.setCondition(fragment.operands.get(0).guard);
                    c.setCons(consequence);
                    listOfGuards.add(consequence);
                    guardToCFMap.put(consequence, c);
                    consequence.setConsequence(true);

                    if (fragment.operands.size() > 1) {
                      Guard alternate = new Guard(fragment.operands.get(1)._id);
                      alternate.setCondition(fragment.operands.get(1).guard);
                      c.setAlt(alternate);
                      listOfGuards.add(alternate);
                      guardToCFMap.put(alternate, c);
                      alternate.setAlternative(true);
                    }
                  }

                  if (fragment.tags != null) {
                    for (Element tag : fragment.tags) {
                      if (tag.name.equals("parent")) {
                        List<Instruction> instructionList =
                            combinedFragments
                                .stream()
                                .filter(e -> e.getId().equals(tag.reference.$ref))
                                .collect(Collectors.toList());
                        if (instructionList.size() > 0) {
                          instructionList.get(0).getBlock().add(instruction);
                          instruction.setParent(instructionList.get(0));
                        }
                      }
                    }
                  }
                }
              }

              // parsing the messages and make nodes out them to later build a tree from the
              // lifelines
              ArrayList<Element> messages = umlInteraction.messages;
              Element startMessage = messages.get(0);
              String sourceRef = startMessage.source.$ref;
              String targetRef = startMessage.target.$ref;
              Element endMessage = null;

              LifeLine sourceLifeLine = getLifeLine(lifeLines, sourceRef);
              LifeLine targetLifeLine = getLifeLine(lifeLines, targetRef);

              // First message processing
              parentMessage = new MethodInvocation();
              parentMessage.setAssignmentTarget(startMessage.assignmentTarget);
              parentMessage.setMessageSort(startMessage.messageSort);
              parentMessage.setSource(sourceLifeLine.getMetaClass());
              parentMessage.setTarget(targetLifeLine.getMetaClass());
              parentMessage.setName(startMessage.name);
              parentMessage.setId(startMessage._id);
              if (sourceLifeLine.getId().equals(targetLifeLine.getId())) {
                parentMessage.setCallerObject("this");
              } else {
                parentMessage.setCallerObject(targetLifeLine.getName());
              }
              int weight = 0;
              parentMessage.setWeight(weight++);
              if (startMessage.signature != null) {
                parentMessage.setSignature(startMessage.signature.$ref);
              }

              if (startMessage.tags != null) {
                for (Element tag : startMessage.tags) {
                  //                                    if (tag.name.equals("CF")) {
                  //                                        parentMessage.setInCF(true);
                  //
                  // parentMessage.setCfID(tag.reference.$ref);
                  //                                    }
                  if (tag.name.equals("operand")) {
                    parentMessage.setOperandId(tag.reference.$ref);
                  }
                }
              }

              MethodInvocation rootMessage = parentMessage;
              methodInvocations.add(rootMessage);
              rootMessages.add(rootMessage);
              Iterator<Element> iter = messages.iterator();
              while (iter.hasNext()) {
                if (iter.next() == endMessage) {
                  continue;
                }

                iter.remove();
                List<Element> childMessages = getChildMessages(messages, targetRef);
                for (Element child : childMessages) {

                  LifeLine childSource = getLifeLine(lifeLines, child.source.$ref);
                  LifeLine childTarget = getLifeLine(lifeLines, child.target.$ref);

                  MethodInvocation childMessage = new MethodInvocation();
                  childMessage.setMessageSort(child.messageSort);
                  childMessage.setSource(childSource.getMetaClass());
                  childMessage.setTarget(childTarget.getMetaClass());
                  childMessage.setAssignmentTarget(child.assignmentTarget);
                  childMessage.setName(child.name);
                  childMessage.setId(child._id);
                  childMessage.setWeight(weight++);
                  childMessage.setArguments(child.arguments);

                  if (childSource.getId().equals(childTarget.getId())) {
                    childMessage.setCallerObject("this");
                  } else {
                    childMessage.setCallerObject(childTarget.getName());
                  }

                  if (child.signature != null) {
                    childMessage.setSignature(child.signature.$ref);
                  }

                  if (child.tags != null) {
                    for (Element tag : child.tags) {
                      //                                            if (tag.name.equals("CF")) {
                      //                                                childMessage.setInCF(true);
                      //
                      // childMessage.setCfID(tag.reference.$ref);
                      //                                            }
                      if (tag.name.equals("operand")) {
                        childMessage.setOperandId(tag.reference.$ref);
                      }
                    }
                  }

                  parentMessage.childNodes.add(childMessage);
                  methodInvocations.add(childMessage);
                }

                if (childMessages.size() > 0) {
                  List<MethodInvocation> nextMessage =
                      parentMessage
                          .childNodes
                          .stream()
                          .filter(f -> !f.source.equals(f.target))
                          .collect(Collectors.toList());
                  List<Element> startMessageNext =
                      childMessages
                          .stream()
                          .filter(f -> !f.source.$ref.equals(f.target.$ref))
                          .collect(Collectors.toList());
                  startMessage = startMessageNext.get(0);
                  targetRef = startMessage.target.$ref;
                  sourceRef = startMessage.source.$ref;

                  parentMessage = nextMessage.get(0);

                  if (childMessages.size() > 1) {
                    endMessage = childMessages.get(childMessages.size() - 1);
                  }
                }
              }
            }

            for (MethodInvocation methodInvocation : methodInvocations) {
              List<Operation> matchingOperation =
                  operationsList
                      .stream()
                      .filter(f -> f._id.equals(methodInvocation.getSignature()))
                      .collect(Collectors.toList());
              if (matchingOperation.size() > 0) {
                operationMap.put(methodInvocation, matchingOperation.get(0)._id);
                methodInvocation.setOperation(matchingOperation.get(0));
              }
            }

            Stack stack = new Stack();
            for (MethodInvocation root : methodInvocations) {
              stack.push(root);
              while (!stack.empty()) {
                MethodInvocation methodInvocation = (MethodInvocation) stack.pop();
                Operation currentOperation = methodInvocation.getOperation();

                if (currentOperation != null) {
                  // all child nodes of this node make up its body
                  List<MethodInvocation> childNodes = methodInvocation.childNodes;
                  for (MethodInvocation child : childNodes) {
                    stack.push(child);
                  }
                  for (MethodInvocation childNode : childNodes) {
                    if (childNode.getOperandId() != null) {
                      List<Instruction> combinedFragmentsList =
                          combinedFragments
                              .stream()
                              .filter(f -> f.getId().equals(childNode.getCfID()))
                              .collect(Collectors.toList());

                      List<Guard> guardList =
                          listOfGuards
                              .stream()
                              .filter(f -> f.id.equals(childNode.getOperandId()))
                              .collect(Collectors.toList());

                      if (guardList.size() > 0) {
                        Guard currentGuard = guardList.get(0);
                        Instruction instruction = guardToCFMap.get(guardList.get(0));
                        // get the topmost CF if it is in a tree
                        Instruction parent = instruction.getParent();

                        while (instruction.getParent() != null) {
                          instruction = instruction.getParent();
                        }

                        if (currentGuard.isConsequence) {
                          Conditional conditional = (Conditional) instruction;
                          if (!conditional.getConsequence().contains(childNode)) {
                            conditional.getConsequence().add(childNode);
                          }
                        }
                        if (currentGuard.isAlternative) {
                          Conditional conditional = (Conditional) instruction;
                          if (!conditional.getAlternative().contains(childNode)) {
                            conditional.getAlternative().add(childNode);
                          }
                        }
                        if (!currentGuard.isAlternative && !currentGuard.isConsequence) {
                          Loop loop = (Loop) instruction;
                          loop.getBlock().add(childNode);
                        } else {
                          if (!currentOperation.getBlock().contains(instruction)) {
                            currentOperation.getBlock().add(instruction);
                          }
                        }
                      }
                    } else {
                      if (!currentOperation.getBlock().contains(childNode)) {
                        currentOperation.getBlock().add(childNode);
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    //
    ////        printAllData(metaClasses);
    //        while (parentMessage.childNodes != null || parentMessage.childNodes.size() > 0) {
    //            System.out.println("parent " + parentMessage.name);
    //            for (com.cbpro.main.MethodInvocation child : parentMessage.childNodes) {
    //                System.out.println("child " + child.name);
    //            }
    //            if (parentMessage.childNodes.size() > 0) {
    //                parentMessage = parentMessage.childNodes.get(0);
    //            } else {
    //                break;
    //            }
    //        }

    mainPackage.print();
    File dir = new File("/home/ramyashenoy/Desktop/DemoFolder/" + mainPackage.getName());

    boolean successful = dir.mkdir();
    if (successful) {
      System.out.println("directory was created successfully");
      for (MetaClass metaClass : metaClasses) {
        if (metaClass.name.equals("Main")) {
          continue;
        } else {
          String data = metaClass.print();
          BufferedWriter out = null;
          try {
            FileWriter fstream =
                new FileWriter(
                    dir.getPath() + "/" + metaClass.name + ".java",
                    true); // true tells to append data.
            out = new BufferedWriter(fstream);
            out.write(data);
          } catch (IOException e) {
            System.err.println("Error: " + e.getMessage());
          } finally {
            if (out != null) {
              out.close();
            }
          }
        }
      }
    } else {
      // creating the directory failed
      System.out.println("failed trying to create the directory");
    }

    mainPackage.setClasses(metaClasses);
  }
示例#3
0
  // New -- returns data in HashMap
  private static Map viewSignups(
      HttpServletRequest req, PrintWriter out, Connection con, boolean json_mode) {

    int wait_list_id = 0;
    int wait_list_signup_id = 0;
    int sum_players = 0;
    int date = 0;
    int pos = 1;
    int time = SystemUtils.getTime(con);
    int today_date = (int) SystemUtils.getDate(con);
    int start_time = 0;
    int end_time = 0;
    int count = 0;
    int index = 0;
    int player_index = 0;
    Map waitlist_map = new HashMap();
    waitlist_map.put("options", new HashMap());
    waitlist_map.put("signups", new LinkedHashMap());

    String sindex =
        req.getParameter(
            "index"); //  index value of day (needed by Proshop_waitlist_slot when returning)
    String id = req.getParameter("waitListId"); //  uid of the wait list we are working with
    String course = (req.getParameter("course") == null) ? "" : req.getParameter("course");
    String returnCourse =
        (req.getParameter("returnCourse") == null) ? "" : req.getParameter("returnCourse");
    String sdate = (req.getParameter("sdate") == null) ? "" : req.getParameter("sdate");
    String name = (req.getParameter("name") == null) ? "" : req.getParameter("name");
    String day_name = (req.getParameter("day_name") == null) ? "" : req.getParameter("day_name");
    String sstart_time =
        (req.getParameter("start_time") == null) ? "" : req.getParameter("start_time");
    String send_time = (req.getParameter("end_time") == null) ? "" : req.getParameter("end_time");
    // String count = (req.getParameter("count") == null) ? "" : req.getParameter("count");
    String jump = req.getParameter("jump");

    String fullName = "";
    String cw = "";
    String notes = "";
    String nineHole = "";

    PreparedStatement pstmt = null;
    PreparedStatement pstmt2 = null;

    boolean tmp_found = false;
    boolean tmp_found2 = false;
    boolean master =
        (req.getParameter("view") != null && req.getParameter("view").equals("master"));
    boolean show_notes =
        (req.getParameter("show_notes") != null && req.getParameter("show_notes").equals("yes"));
    boolean alt_row = false;
    boolean tmp_converted = false;

    try {

      date = Integer.parseInt(sdate);
      index = Integer.parseInt(sindex);
      wait_list_id = Integer.parseInt(id);
      start_time = Integer.parseInt(sstart_time);
      end_time = Integer.parseInt(send_time);
    } catch (NumberFormatException e) {
    }

    try {

      count = getWaitList.getListCount(wait_list_id, date, index, time, !master, con);

    } catch (Exception exp) {
      out.println(exp.getMessage());
    }

    //
    //  isolate yy, mm, dd
    //
    int yy = date / 10000;
    int temp = yy * 10000;
    int mm = date - temp;
    temp = mm / 100;
    temp = temp * 100;
    int dd = mm - temp;
    mm = mm / 100;

    String report_date = SystemUtils.getLongDateTime(today_date, time, " at ", con);

    if (!json_mode) {
      out.println("<br>");
      out.println(
          "<h3 align=center>"
              + ((master) ? "Master Wait List Sign-up Sheet" : "Current Wait List Sign-ups")
              + "</h3>");

      out.println("<p align=center><font size=3><b><i>\"" + name + "\"</i></b></font></p>");

      out.println("<table border=0 align=center>");

      out.println("<tr><td><font size=\"2\">");
      out.println(
          "Date:&nbsp;&nbsp;<b>"
              + day_name
              + "&nbsp;&nbsp;"
              + mm
              + "/"
              + dd
              + "/"
              + yy
              + "</b></td>");
      out.println("<td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</td><td>");
      if (!course.equals("")) {
        out.println("<font size=\"2\">Course:&nbsp;&nbsp;<b>" + course + "</b></font>");
      }
      out.println("</td></tr>");

      out.println(
          "<tr><td><font size=\"2\">Time:&nbsp;&nbsp;<b>"
              + SystemUtils.getSimpleTime(start_time)
              + " to "
              + SystemUtils.getSimpleTime(end_time)
              + "</b></font></td>");

      out.println("<td></td>");

      out.println("<td><font size=\"2\">Signups:&nbsp;&nbsp;<b>" + count + "</b></font></td>");

      out.println("</table>");

      out.println(
          "<p align=center><font size=2><b><i>List Generated on "
              + report_date
              + "</i></b></font></p>");

      out.println("<table align=center border=1 bgcolor=\"#F5F5DC\">");

      if (master) {

        out.println(
            "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">"
                + "<td height=35>&nbsp;Pos&nbsp;</td>"
                + "<td>Sign-up Time</td>"
                + "<td>Members</td>"
                + "<td>Desired Time</td>"
                + "<td>&nbsp;Players&nbsp;</td>"
                + "<td>&nbsp;On Sheet&nbsp;</td>"
                + "<td>Converted At</td>"
                + "<td>&nbsp;Converted By&nbsp;</td>"
                + ((show_notes) ? "<td>&nbsp;Notes&nbsp;</td>" : "")
                + "</tr>");
      } else {

        out.println(
            "<tr bgcolor=\"#8B8970\" align=center style=\"color: black; font-weight: bold\">"
                + "<td height=35>&nbsp;Pos&nbsp;</td>"
                + "<td>Members</td>"
                + "<td>Desired Time</td>"
                + "<td>&nbsp;Players&nbsp;</td>"
                + ((show_notes) ? "<td>&nbsp;Notes&nbsp;</td>" : "")
                + "</tr>"); // +
        // "<td>&nbsp;On Sheet&nbsp;</td>" +
        // "</tr>");
        // ((multi == 0) ? "" : "<td>Course</td>") +
      }
      out.println(
          "<!-- wait_list_id=" + wait_list_id + ", date=" + date + ", time=" + time + " -->");
    }

    try {

      pstmt =
          con.prepareStatement(
              ""
                  + "SELECT *, "
                  + "DATE_FORMAT(created_datetime, '%c/%e/%y %r') AS created_time, "
                  + "DATE_FORMAT(converted_at, '%c/%e/%y %r') AS converted_time "
                  + // %l:%i %p
                  "FROM wait_list_signups "
                  + "WHERE wait_list_id = ? AND date = ? "
                  + ((master) ? "" : "AND converted = 0 ")
                  + ((!master && sindex.equals("0")) ? "AND ok_etime > ? " : "")
                  + "ORDER BY created_datetime");

      pstmt.clearParameters();
      pstmt.setInt(1, wait_list_id);
      pstmt.setInt(2, date);
      if (!master && sindex.equals("0")) {
        pstmt.setInt(3, time);
      }

      ResultSet rs = pstmt.executeQuery();

      while (rs.next()) {

        wait_list_signup_id = rs.getInt("wait_list_signup_id");

        if (json_mode) {
          ((Map) waitlist_map.get("signups"))
              .put("signup_id_" + wait_list_signup_id, new LinkedHashMap());
          ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id))
              .put("players", new LinkedHashMap());
          ((Map) ((Map) waitlist_map.get("signups")).get("signup_id_" + wait_list_signup_id))
              .put("options", new HashMap());
        } else {
          out.print(
              "<tr align=center"
                  + ((alt_row) ? " style=\"background-color:white\"" : "")
                  + "><td>"
                  + pos
                  + "</td>");
          if (master) {
            out.println("<td>&nbsp;" + rs.getString("created_time") + "&nbsp;</td>");
          }
          out.print("<td align=left>");
        }
        // if (multi == 1) out.println("<td>" + rs.getString("course") + "</td>");

        //
        //  Display players in this signup
        //
        pstmt2 =
            con.prepareStatement(
                ""
                    + "SELECT * "
                    + "FROM wait_list_signups_players "
                    + "WHERE wait_list_signup_id = ? "
                    + "ORDER BY pos");

        pstmt2.clearParameters();
        pstmt2.setInt(1, wait_list_signup_id);

        ResultSet rs2 = pstmt2.executeQuery();

        tmp_found2 = false;
        player_index = 0;

        while (rs2.next()) {

          if (json_mode) {
            player_index++;
            ((Map)
                    ((Map)
                            ((Map) waitlist_map.get("signups"))
                                .get("signup_id_" + wait_list_signup_id))
                        .get("players"))
                .put("player_" + player_index, new HashMap());
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("player_name", rs2.getString("player_name"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("player_name", rs2.getString("player_name"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("cw", rs2.getString("cw"));
            ((Map)
                    ((Map)
                            ((Map)
                                    ((Map) waitlist_map.get("signups"))
                                        .get("signup_id_" + wait_list_signup_id))
                                .get("players"))
                        .get("player_" + player_index))
                .put("9hole", rs2.getInt("9hole"));
          } else {
            fullName = rs2.getString("player_name");
            cw = rs2.getString("cw");
            if (rs2.getInt("9hole") == 1) {
              cw = cw + "9";
            }
            if (tmp_found2) {
              out.print(",&nbsp; ");
            } else {
              out.print("&nbsp;");
            }
            out.print(fullName + " <font style=\"font-size:9px\">(" + cw + ")</font>");
            tmp_found2 = true;
          }
          sum_players++;
          nineHole = ""; // reset
        }

        pstmt2.close();

        if (json_mode) {

          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("notes", notes);
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("created_time", rs.getInt("created_time"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted", rs.getInt("converted"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted_time", rs.getString("converted_time"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("converted_by", rs.getString("converted_by"));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("start_time", SystemUtils.getSimpleTime(rs.getInt("ok_stime")));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("end_time", SystemUtils.getSimpleTime(rs.getInt("ok_etime")));
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("wait_list_signup_id", wait_list_signup_id);
          ((Map)
                  ((Map)
                          ((Map) waitlist_map.get("signups"))
                              .get("signup_id_" + wait_list_signup_id))
                      .get("options"))
              .put("player_count", sum_players);
        } else {
          out.print("</td>");
          out.println(
              "<td>&nbsp;"
                  + SystemUtils.getSimpleTime(rs.getInt("ok_stime"))
                  + " - "
                  + SystemUtils.getSimpleTime(rs.getInt("ok_etime"))
                  + "&nbsp;</td>");
          out.println("<td>" + sum_players + "</td>");

          if (master) {

            tmp_converted = rs.getInt("converted") == 1;
            out.println("<td>" + ((tmp_converted) ? "Yes" : "No") + "</td>");
            out.println(
                "<td>" + ((tmp_converted) ? rs.getString("converted_time") : "&nbsp;") + "</td>");
            out.println(
                "<td>" + ((tmp_converted) ? rs.getString("converted_by") : "&nbsp;") + "</td>");
          }

          if (show_notes) {

            notes = rs.getString("notes").trim();
            if (notes.equals("")) {
              notes = "&nbsp;";
            }
            out.println("<td>" + notes + "</td>");
          }

          out.print("</tr>");
        }

        pos++;
        sum_players = 0;
        alt_row = alt_row == false;
      }

      pstmt.close();

    } catch (Exception exc) {

      SystemUtils.buildDatabaseErrMsg(
          "Error loading wait list signups.", exc.toString(), out, false);
    }

    if (json_mode) {

      ((Map) waitlist_map.get("options")).put("index", sindex);
      ((Map) waitlist_map.get("options")).put("wait_list_id", wait_list_id);
      ((Map) waitlist_map.get("options")).put("date", "" + mm + "/" + dd + "/" + yy);
      ((Map) waitlist_map.get("options")).put("name", name);
      ((Map) waitlist_map.get("options")).put("time", time);
      ((Map) waitlist_map.get("options")).put("jump", jump);
      ((Map) waitlist_map.get("options")).put("returnCourse", returnCourse);
      ((Map) waitlist_map.get("options")).put("course", course);
      ((Map) waitlist_map.get("options")).put("master", master);
      ((Map) waitlist_map.get("options")).put("report_date", report_date);
      ((Map) waitlist_map.get("options")).put("show_notes", show_notes);

    } else {

      out.println("</table><br>");

      out.println("<table align=center><tr>");

      out.println("<form action=\"Member_jump\" method=\"POST\" target=\"_top\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"0\">");
      out.println("<input type=\"hidden\" name=\"index\" value=" + sindex + ">");
      out.println(
          "<input type=\"hidden\" name=\"course\" value=\""
              + ((!returnCourse.equals("")) ? returnCourse : course)
              + "\">");

      out.println("<td><input type=\"submit\" value=\"Tee Sheet\"></td></form>");

      out.println("<td>&nbsp;&nbsp;</td>");

      out.println("<form action=\"Member_waitlist\" method=\"POST\">");
      out.println("<input type=\"hidden\" name=\"waitListId\" value=\"" + wait_list_id + "\">");
      out.println("<input type=\"hidden\" name=\"date\" value=\"" + date + "\">");
      out.println("<input type=\"hidden\" name=\"day\" value=\"" + day_name + "\">");
      out.println("<input type=\"hidden\" name=\"index\" value=\"" + sindex + "\">");
      out.println("<input type=\"hidden\" name=\"course\" value=\"" + course + "\">");
      out.println("<input type=\"hidden\" name=\"returnCourse\" value=\"" + returnCourse + "\">");
      out.println("<input type=\"hidden\" name=\"jump\" value=\"" + jump + "\">");

      out.println("<td><input type=\"submit\" value=\"Return\"></td></form>");

      out.println("</tr></table></form>");

      out.println("<br>");
    }

    return waitlist_map;
  } // end viewSignups
示例#4
0
  private void customizeNodes(ConfigProcessor processor, CIJob job)
      throws JDOMException, PhrescoException {

    // SVN url customization
    if (SVN.equals(job.getRepoType())) {
      S_LOGGER.debug("This is svn type project!!!!!");
      processor.changeNodeValue(SCM_LOCATIONS_REMOTE, job.getSvnUrl());
    } else if (GIT.equals(job.getRepoType())) {
      S_LOGGER.debug("This is git type project!!!!!");
      processor.changeNodeValue(SCM_USER_REMOTE_CONFIGS_URL, job.getSvnUrl());
      processor.changeNodeValue(SCM_BRANCHES_NAME, job.getBranch());
      // cloned workspace
    } else if (CLONED_WORKSPACE.equals(job.getRepoType())) {
      S_LOGGER.debug("Clonned workspace selected!!!!!!!!!!");
      processor.useClonedScm(job.getUsedClonnedWorkspace(), SUCCESSFUL);
    }

    // Schedule expression customization
    processor.changeNodeValue(TRIGGERS_SPEC, job.getScheduleExpression());

    // Triggers Implementation
    List<String> triggers = job.getTriggers();

    processor.createTriggers(TRIGGERS, triggers, job.getScheduleExpression());

    // if the technology is java stanalone and functional test , goal have to specified in post
    // build step only
    if (job.isEnablePostBuildStep() && FUNCTIONAL_TEST.equals(job.getOperation())) {
      // Maven command customization
      processor.changeNodeValue(GOALS, CI_FUNCTIONAL_ADAPT.trim());
    } else {
      // Maven command customization
      processor.changeNodeValue(GOALS, job.getMvnCommand());
    }

    // Recipients customization
    Map<String, String> email = job.getEmail();

    // Failure Reception list
    processor.changeNodeValue(
        TRIGGER_FAILURE_EMAIL_RECIPIENT_LIST, (String) email.get(FAILURE_EMAILS));

    // Success Reception list
    processor.changeNodeValue(
        TRIGGER_SUCCESS__EMAIL_RECIPIENT_LIST, (String) email.get(SUCCESS_EMAILS));

    // enable collabnet file release plugin integration
    if (job.isEnableBuildRelease()) {
      S_LOGGER.debug("Enablebling collabnet file release plugin ");
      processor.enableCollabNetBuildReleasePlugin(job);
    }

    // use clonned scm
    if (CLONED_WORKSPACE.equals(job.getRepoType())) {
      S_LOGGER.debug("using cloned workspace ");
      processor.useClonedScm(job.getUsedClonnedWorkspace(), SUCCESSFUL);
    }

    // clone workspace for future use
    if (job.isCloneWorkspace()) {
      S_LOGGER.debug("Clonning the workspace ");
      processor.cloneWorkspace(ALL_FILES, SUCCESSFUL, TAR);
    }

    // Build Other projects
    if (StringUtils.isNotEmpty(job.getDownStreamProject())) {
      S_LOGGER.debug("Enabling downstream project!!!!!!");
      processor.buildOtherProjects(job.getDownStreamProject());
    }

    // pom location specifier
    if (StringUtils.isNotEmpty(job.getPomLocation())) {
      S_LOGGER.debug("POM location changing " + job.getPomLocation());
      processor.updatePOMLocation(job.getPomLocation());
    }

    if (job.isEnablePostBuildStep()) {
      System.out.println("java stanalone technology with functional test enabled!!!!!!!");
      String mvnCommand = job.getMvnCommand();
      String[] ciAdapted =
          mvnCommand.split(CI_FUNCTIONAL_ADAPT); // java stanalone functional test alone
      for (String ciCommand : ciAdapted) {
        S_LOGGER.debug("ciCommand...." + ciCommand);
      }
      // iterate over loop
      processor.enablePostBuildStep(job.getPomLocation(), ciAdapted[1]);
    }

    if (job.isEnablePreBuildStep()) {
      System.out.println("java stanalone technology with functional test enabled!!!!!!!");
      // iterate over loop
      List<String> prebuildStepCommands = job.getPrebuildStepCommands();
      for (String prebuildStepCommand : prebuildStepCommands) {
        processor.enablePreBuildStep(job.getPomLocation(), prebuildStepCommand);
      }
    }
  }