Uruchamia proces generacji treści w oparciu o szablon.

@param templateName Szablon do uruchomienia.
@param properties Mapa parametrów uruchomienia szablonu.
@param workDir Ścieżka do katalogu roboczego.
181488
@Override
	public void executeTemplate(String templateName, Map<String, Object> properties, String workDir) {
		// Pobieranie definicji szablonu do użycia:
		Template<?> template = templateProvider.get(templateName, null, null, null);
		if(template == null) {
			throw new RuntimeException("Nie znaleziono szablonu " + templateName);
		}
		if(template.isAbstract()) {
			throw new AbstractTemplateException(templateName);
		}

		// Weryfikowanie definicji szablonu, szablonu nadrzędnego i wszystkich
		// szablonów używanych. Sprawdzanie dostępność klas silników generatorów.
		templateVerifier.verifyTemplate(template, templateProvider);

		MapStack<String, Object> propertiesStack = new SimpleMapStack<String,Object>();
		propertiesStack.push(new HashMap<String, Object>(properties));
		doExecuteTemplate(template, propertiesStack, workDir);
		propertiesStack.pop();
	}
1108773
public Map<String,Object> addPropertiesFile(Map<String,Object> properties)
    {
        String propertiesPath = (String)properties.get("webStartPropertiesFile");
        if (propertiesPath == null)
            return properties;
        if (propertiesPath.startsWith("/"))
            propertiesPath = propertiesPath.substring(1);
        URL url = null;
        try {
            url = ClassServiceUtility.getClassService().getResourceURL(propertiesPath, null, null, this.getClass().getClassLoader());
        } catch (RuntimeException e) {
            e.printStackTrace();    // ???
        }           
        Reader inStream = null;
        if (url != null)
        {
            try {
                inStream = new InputStreamReader(url.openStream());
            } catch (Exception e) {
                // Not found
            }
        }
        if (inStream != null)
        {
            try {
                // Todo may want to add cache info (using bundle lastModified).
                Properties cachedProperties = new Properties();
                cachedProperties.load(inStream);
                inStream.close();
                for (Object key : cachedProperties.keySet())
                {
                    properties.put(key.toString(), cachedProperties.get(key));
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return properties;
    }
442774
public void writeTemplateSpreadsheetDownloadFile(List<TemplateTokenInfo> tokenNames,
                                                     TemplateVariablesSet variablesSet,
                                                     String filePath) throws TemplateException {

        prepareWriter(filePath);
        writeDownloadSpreadsheetHeader(tokenNames);

        for (int i = 1; i < variablesSet.getEntryCount() + 1; i++) {
            TemplateVariables entryVariables = variablesSet.getEntryValues(i);
            writeSpreadsheetVariableRow(tokenNames, i, entryVariables);
        }

        flushAndCloseWriter();
    }
63905
public void setTemplateVars(List<TemplateVar> templateVars) {
		this.templateVars.clear();
		if(templateVars != null && !templateVars.isEmpty()) {
			this.templateVars.addAll(templateVars);
		}
	}
1098221
@Override
    public void setProperties(Map<Object, Object> properties) {

        Iterator<Object> keys = properties.keySet().iterator();
        while (keys.hasNext()) {
            Object key = keys.next();
            lazyProperties().put(key, properties.get(key));
        }
    }
969077
public void writeProperty(String resourceName, String propertyName, String value) throws CmsException {

        m_cms.lockResource(resourceName);
        m_cms.writePropertyObject(resourceName, new CmsProperty(propertyName, value, null));
    }
802240
public void forAllForeignkeys(String template, Properties attributes) throws XDocletException
    {
        for (Iterator it = _curTableDef.getForeignkeys(); it.hasNext(); )
        {
            _curForeignkeyDef = (ForeignkeyDef)it.next();
            generate(template);
        }
        _curForeignkeyDef = null;
    }
659277
function writeFileSync(templateName, templateOption, filename) {
  var templateString = fs.readFileSync(path.join(__dirname, '/templates/' + templateName), 'utf8');
  fs.writeFileSync(path.join(projectDirectory, filename), Mustache.render(templateString, templateOption));
}
707278
public RunRemoteProcessMessageData setupUserProperties(Map<String, Object> properties)
    {
        try {
            Record recUser = this.getMainRecord();
            
            String processClassName = (String)properties.get(RunRemoteProcessMessageData.PROCESS_CLASS_NAME);
            
            // Step 1 - Get the web site prefix
            String sitePrefix = (String)properties.get(MenusMessageData.SITE_PREFIX);
            String fullSitePrefix = sitePrefix;
            String strDomain = (String)properties.get(DBParams.DOMAIN);
            if (strDomain == null)
            {
                strDomain = this.getProperty(DBParams.DOMAIN);
                if ((strDomain == null) || (strDomain.length() == 0))
                    strDomain = DEFAULT_DOMAIN;
                if (strDomain.indexOf('.') != strDomain.lastIndexOf('.'))
                    strDomain = strDomain.substring(strDomain.indexOf('.') + 1);
            }
            String homeMenu = (String)properties.get(MenusMessageData.SITE_HOME_MENU);
        
            // Next, Create a main site menu for this new domain.
            Record recMenus = this.getRecord(Menus.MENUS_FILE);
            recMenus.addNew();
            String siteTemplate = (String)properties.get(SITE_TEMPLATE_CODE_PARAM);
            recMenus.getField(Menus.CODE).setString(siteTemplate);
            int iOldOrder = recMenus.getDefaultOrder();
            recMenus.setKeyArea(Menus.CODE_KEY);
            BaseBuffer buffer = null;
            if (recMenus.seek(null))
            {
                buffer = new VectorBuffer(null);
                buffer.fieldsToBuffer(recMenus);
            }
            else
                return null;        // Error - Site template does not exist
            recMenus.setKeyArea(iOldOrder);
            
            recMenus.addNew();
            if (buffer != null)     // Always
                buffer.bufferToFields(recMenus, DBConstants.DISPLAY, DBConstants.INIT_MOVE);
            
            recMenus.getField(Menus.SEQUENCE).setValue(100);
            String siteNameTemplate = (String)properties.get(SITE_NAME_TEMPLATE_PARAM);
            if (siteNameTemplate == null)
                siteNameTemplate = "{0}''s Demo site";
            String siteName = MessageFormat.format(siteNameTemplate, sitePrefix.toUpperCase().substring(0,1) + sitePrefix.substring(1));
            recMenus.getField(Menus.NAME).setString(siteName);
            ((PropertiesField)recMenus.getField(Menus.PARAMS)).setProperty(MAIN_USER_PARAM, recUser.getField(UserInfo.USER_NAME).toString());
            String templateArchivePath = ((PropertiesField)recMenus.getField(Menus.PARAMS)).getProperty(DBConstants.USER_ARCHIVE_FOLDER);
            if ((templateArchivePath == null) || (templateArchivePath.length() == 0))
                templateArchivePath = Utility.addToPath(DEFAULT_ARCHIVE_FOLDER, CURRENT_TEST_DATA_DIR);
            
            int iErrorCode = DBConstants.DUPLICATE_KEY;
            int iCounter = 0;
            while (iErrorCode == DBConstants.DUPLICATE_KEY)
            {
                try {
                    fullSitePrefix = sitePrefix;
                    if (iCounter > 0)
                        fullSitePrefix += Integer.toString(iCounter);
        
                    recMenus.getField(Menus.CODE).setString(fullSitePrefix + '.' + strDomain);
        
                    recMenus.add();
                    iErrorCode = DBConstants.NORMAL_RETURN;
                } catch (DBException ex) {
                    iErrorCode = ex.getErrorCode();
                    if (iErrorCode != DBConstants.DUPLICATE_KEY)
                    {
                        ex.printStackTrace();
                        return null;     // Error
                    }
                    iCounter++;
                    if (iCounter >= 100)
                        break;
                }
            }
            // Now we have this user's domain: sitePrefix
            
            // Update the user's account to show they own this new domain
            if (iErrorCode == DBConstants.NORMAL_RETURN)
            {
                iOldOrder = recUser.getDefaultOrder();
                recUser.setKeyArea(UserInfo.ID_KEY);
                recUser.edit();
                ((PropertiesField)recUser.getField(UserInfo.PROPERTIES)).setProperty(MenusMessageData.DOMAIN_NAME, recMenus.getField(Menus.CODE).toString());
                ((PropertiesField)recUser.getField(UserInfo.PROPERTIES)).setProperty(DBParams.HOME, homeMenu);
                recUser.set();
                recUser.setKeyArea(iOldOrder);
            }
            
            TreeMessage message = new TreeMessage(null, null);
            RunRemoteProcessMessageData runRemoteProcessRequest = new RunRemoteProcessMessageData(message, null);
        
            CreateSiteMessageData createSiteRequest = new CreateSiteMessageData(runRemoteProcessRequest, null);
            runRemoteProcessRequest.addMessageDataDesc(createSiteRequest);
            MessageRecordDesc userInfoMessageData = (MessageRecordDesc)createSiteRequest.getMessageDataDesc(UserInfo.USER_INFO_FILE);
            MessageRecordDesc menusMessageData = (MessageRecordDesc)createSiteRequest.getMessageDataDesc(Menus.MENUS_FILE);
            
            String user = this.getProperty(DBParams.USER_NAME);
            String auth = this.getProperty(DBParams.AUTH_TOKEN);
            runRemoteProcessRequest.put(RunRemoteProcessMessageData.PROCESS_CLASS_NAME, processClassName);
            runRemoteProcessRequest.put(DBParams.USER_NAME, user);
            runRemoteProcessRequest.put(DBParams.AUTH_TOKEN, auth);
            
            userInfoMessageData.putRawRecordData(recUser);  // User, password
        
            menusMessageData.put(MenusMessageData.DOMAIN_NAME, fullSitePrefix + '.' + strDomain);
            menusMessageData.put(MenusMessageData.SITE_PREFIX, fullSitePrefix);
            menusMessageData.put(MenusMessageData.SITE_NAME, siteName);
            menusMessageData.put(MenusMessageData.XSL_TEMPLATE_PATH, templateArchivePath);
            menusMessageData.put(MenusMessageData.SITE_TEMPLATE_MENU, siteTemplate);
            menusMessageData.put(MenusMessageData.SITE_HOME_MENU, homeMenu);
        
            return runRemoteProcessRequest;
            
        } catch (DBException ex) {
            return null;
        }
    }
544737
public void setProperties(Map<String, Object> properties)
    {
        if (this.getParentRecordOwner() != null)
            this.getParentRecordOwner().setProperties(properties);
    }
648531
public void templateModem_name_DELETE(String name) throws IOException {
		String qPath = "/xdsl/templateModem/{name}";
		StringBuilder sb = path(qPath, name);
		exec(qPath, "DELETE", sb.toString(), null);
	}
222282
private static Properties _newInitedProp(String templateDir, String charset) {
		final Properties properties = new Properties();

		properties.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, templateDir);
		properties.setProperty(Velocity.ENCODING_DEFAULT, charset);
		properties.setProperty(Velocity.INPUT_ENCODING, charset);
		// properties.setProperty(Velocity.OUTPUT_ENCODING, charset);

		return properties;
	}
347922
public void setProperties(Properties properties) {
		baseDir = properties.getProperty("base_dir", baseDir);
		inputFileLocation = baseDir + '/' + properties.getProperty("input_file_location", inputFileLocation);
		outputFileLocation = baseDir + '/' + properties.getProperty("output_file_location", outputFileLocation);
		tempOutputFileLocation = baseDir + '/' + properties.getProperty("temp_output_file_location", tempOutputFileLocation);
	}
552045
function ClassHelper (name, properties, template) {
  // props
  if (!properties) {
    throw new Error('ヘルパーを作成できません。プロパティの設定が存在しません');
  }
  this.name = name || '';
  this.props = properties;
  // template
  this.tpl = null;
  if (typeof template === 'string') {
    this.tpl = template.split(EOL);
  } else if (Array.isArray(template)) {
    this.tpl = template;
  }
}
732702
public void installationTemplate_templateName_DELETE(String templateName) throws IOException {
		String qPath = "/me/installationTemplate/{templateName}";
		StringBuilder sb = path(qPath, templateName);
		exec(qPath, "DELETE", sb.toString(), null);
	}
766712
@Override
    public void addProperties(Map<Object, Object> properties) {
        if (properties == null) return;
        lazyProperties().putAll(properties);
        notifyChanged();
    }
616890
@TaskAction
	public void generateBuildProperties() {
		try {
			new BuildPropertiesWriter(new File(getDestinationDir(),
					"build-info.properties")).writeBuildProperties(new ProjectDetails(
							this.properties.getGroup(),
							(this.properties.getArtifact() != null)
									? this.properties.getArtifact() : "unspecified",
							this.properties.getVersion(), this.properties.getName(),
							this.properties.getTime(),
							coerceToStringValues(this.properties.getAdditional())));
		}
		catch (IOException ex) {
			throw new TaskExecutionException(this, ex);
		}
	}