Merges partial (clique) templates into a full one.

@param dt date template
@param location location
@param wi workshop/conference info template
@return the {@link PascalTemplate} resulting from this merge.
511871
public static PascalTemplate mergeCliqueTemplates(DateTemplate dt, String location, InfoTemplate wi) {
    PascalTemplate pt = new PascalTemplate();
    pt.setValue("workshopnotificationofacceptancedate", dt.noadate);
    pt.setValue("workshopcamerareadycopydate", dt.crcdate);
    pt.setValue("workshopdate", dt.workdate);
    pt.setValue("workshoppapersubmissiondate", dt.subdate);
    pt.setValue("workshoplocation", location);
    pt.setValue("workshopacronym", wi.wacronym);
    pt.setValue("workshophomepage", wi.whomepage);
    pt.setValue("workshopname", wi.wname);
    pt.setValue("conferenceacronym", wi.cacronym);
    pt.setValue("conferencehomepage", wi.chomepage);
    pt.setValue("conferencename", wi.cname);
    return pt;
  }
1303213
@Deprecated
    public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl,
                                                                         Template template, ImmutableList<?> args) {
        return new DateTemplate<T>(cl, template, args);
    }
606353
public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl,
                                                                         Template template, Object... args) {
        return timeTemplate(cl, template, ImmutableList.copyOf(args));
    }
127247
private void addCalendarDay(MpxjTreeNode parentNode, ProjectCalendar calendar, final Day day)
   {
      MpxjTreeNode dayNode = new MpxjTreeNode(day)
      {
         @Override public String toString()
         {
            return day.name();
         }
      };
      parentNode.add(dayNode);
      addHours(dayNode, calendar.getHours(day));
   }
96644
public static PredicateTemplate predicateTemplate(String template, List<?> args) {
        return predicateTemplate(TemplateFactory.DEFAULT.create(template), args);
    }
451708
public static XMLGregorianCalendar convertDateToXMLGregorianCalendar(final Date date) {
        try {
            GregorianCalendar cal = new GregorianCalendar();
            cal.setTime(date);
            XMLGregorianCalendar calXml = DatatypeFactory.newInstance().newXMLGregorianCalendar(
                    cal.get(Calendar.YEAR),
                    cal.get(Calendar.MONTH) + 1,
                    cal.get(Calendar.DAY_OF_MONTH),
                    cal.get(Calendar.HOUR_OF_DAY),
                    cal.get(Calendar.MINUTE),
                    cal.get(Calendar.SECOND),
                    cal.get(Calendar.MILLISECOND),
                    0);
            return calXml;
        } catch (DatatypeConfigurationException e) {
            throw new SwidException("Cannot convert date", e);
        }
    }
1369733
public static TLVElement create(int type, Date value) throws TLVParserException {
        TLVElement element = create(type);
        element.setDateContent(value);
        return element;
    }
807494
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WDateField dateField = (WDateField) component;
		XmlStringBuilder xml = renderContext.getWriter();
		boolean readOnly = dateField.isReadOnly();

		Date date = dateField.getDate();

		xml.appendTagOpen("ui:datefield");
		xml.appendAttribute("id", component.getId());
		xml.appendOptionalAttribute("class", component.getHtmlClass());
		xml.appendOptionalAttribute("track", component.isTracking(), "true");
		xml.appendOptionalAttribute("hidden", dateField.isHidden(), "true");
		if (readOnly) {
			xml.appendAttribute("readOnly", "true");
		} else {
			xml.appendOptionalAttribute("disabled", dateField.isDisabled(), "true");
			xml.appendOptionalAttribute("required", dateField.isMandatory(), "true");
			xml.appendOptionalAttribute("toolTip", dateField.getToolTip());
			xml.appendOptionalAttribute("accessibleText", dateField.getAccessibleText());

			WComponent submitControl = dateField.getDefaultSubmitButton();
			String submitControlId = submitControl == null ? null : submitControl.getId();
			xml.appendOptionalAttribute("buttonId", submitControlId);

			Date minDate = dateField.getMinDate();
			Date maxDate = dateField.getMaxDate();
			if (minDate != null) {
				xml.appendAttribute("min", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(minDate));
			}
			if (maxDate != null) {
				xml.appendAttribute("max", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(maxDate));
			}

			String autocomplete = dateField.getAutocomplete();
			xml.appendOptionalAttribute("autocomplete", !Util.empty(autocomplete), autocomplete);
		}

		if (date != null) {
			xml.appendAttribute("date", new SimpleDateFormat(INTERNAL_DATE_FORMAT).format(date));
		}

		xml.appendClose();

		if (date == null) {
			xml.appendEscaped(dateField.getText());
		}

		if (!readOnly) {
			DiagnosticRenderUtil.renderDiagnostics(dateField, renderContext);
		}

		xml.appendEndTag("ui:datefield");
	}
424648
private DateGroup singleParse(TokenStream stream, String fullText, Date referenceDate) {
	DateGroup group = null;
	List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
	if(tokens.isEmpty()) return group;
		
    StringBuilder tokenString = new StringBuilder();
    for(Token token:tokens) {
      tokenString.append(DateParser.tokenNames[token.getType()]);
      tokenString.append(" ");
    }

    try {
      // parse 
      ParseListener listener = new ParseListener();
      DateParser parser = new DateParser(stream, listener);
      DateParser.parse_return parseReturn = parser.parse();
      
      Tree tree = (Tree) parseReturn.getTree();

      // we only continue if a meaningful syntax tree has been built
      if(tree.getChildCount() > 0) {
        _logger.info("PARSE: " + tokenString.toString());

        // rewrite the tree (temporary fix for http://www.antlr.org/jira/browse/ANTLR-427)
        CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);
        TreeRewrite s = new TreeRewrite(nodes);
        tree = (CommonTree)s.downup(tree);

        // and walk it
        nodes = new CommonTreeNodeStream(tree);
        nodes.setTokenStream(stream);
        DateWalker walker = new DateWalker(nodes);
        walker.setReferenceDate(referenceDate);
        walker.getState().setDefaultTimeZone(_defaultTimeZone);
        walker.parse();
        _logger.info("AST: " + tree.toStringTree());

        // run through the results and append the parse information
        group = walker.getState().getDateGroup();
        ParseLocation location = listener.getDateGroupLocation();
        group.setLine(location.getLine());
        group.setText(location.getText());
        group.setPosition(location.getStart());
        group.setSyntaxTree(tree);
        group.setParseLocations(listener.getLocations());
        group.setFullText(fullText);

        // if the group's matching text has an immediate alphabetic prefix or suffix,
        // we ignore this result
        String prefix = group.getPrefix(1);
        String suffix = group.getSuffix(1);
        if((!prefix.isEmpty() && Character.isLetter(prefix.charAt(0))) ||
            (!suffix.isEmpty() && Character.isLetter(suffix.charAt(0)))) {

          group = null;
        }

      }

    } catch(RecognitionException e) {
      _logger.debug("Could not parse input", e);
    }

    return group;
  }
1071930
private I_CmsListDateRestriction parseFromToday(CmsXmlContentValueLocation dateRestriction) {

        CmsXmlContentValueLocation location = dateRestriction.getSubValue(N_FROM_TODAY);
        if (location == null) {
            return null;
        }
        CmsXmlContentValueLocation countLoc = location.getSubValue(N_COUNT);
        CmsXmlContentValueLocation unitLoc = location.getSubValue(N_UNIT);
        CmsXmlContentValueLocation directionLoc = location.getSubValue(N_DIRECTION);

        TimeDirection direction = parseDirection(directionLoc);
        Integer count = parsePositiveNumber(countLoc);
        TimeUnit unit = parseUnit(unitLoc);
        if (count == null) {
            return null;
        }
        return new CmsListDateFromTodayRestriction(count.intValue(), unit, direction);
    }
1038077
public String template(String template, Map<String,Object> data)
            throws ScriptException,ScriptLimitException,SyntaxException{
        return template(null,template,data);
    }
632813
private Node createTemplateNode() {
    // The Node type choice is arbitrary.
    Node templateNode = new Node(Token.SCRIPT);
    templateNode.setStaticSourceFile(sourceFile);
    return templateNode;
  }
45948
public static <T extends Comparable<?>> ComparableTemplate<T> comparableTemplate(Class<? extends T> cl,
            String template, Object... args) {
        return comparableTemplate(cl, createTemplate(template), ImmutableList.copyOf(args));
    }
1238816
public static <T extends Comparable<?>> DateTemplate<T> dateTemplate(Class<? extends T> cl, String template, List<?> args) {
        return dateTemplate(cl, createTemplate(template), args);
    }
1019458
public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, List<?> args) {
        return dslTemplate(cl, createTemplate(template), args);
    }
704282
public static PredicateTemplate predicateTemplate(Template template, List<?> args) {
        return new PredicateTemplate(template, ImmutableList.copyOf(args));
    }
175956
public HashMap addEvent(String date, boolean useTemp) {
        HashMap ret = new HashMap();
        if (useTemp) {
            ret.putAll(template);
        } else {
            ret.put("event", eventType);
        }
        ret.put("date", date);
        getInertIndex(ret);
        events.add(next, ret);
        return ret;
    }