删除模板

@param templateId 模板ID
@return 删除结果
501326
public BaseResponse delTemplate(String templateId) {
        LOG.debug("删除模板......");
        BeanUtil.requireNonNull(templateId, "templateId is null");
        String url = BASE_API_URL + "cgi-bin/template/del_private_template?access_token=#";
        Map<String, String> map = new HashMap<String, String>();
        map.put("template_id", templateId);
        BaseResponse r = executePost(url, JSONUtil.toJson(map));
        String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
        return JSONUtil.toBean(resultJson, BaseResponse.class);
    }
1341819
public Result readTemplate(String template,
                               boolean delete) {
        Result result = getFromResultPool();
        ValueSet vs = null;
        if (template == null) {
            return result;
        }
        if (!this.disableTemplatesSupport) {
            if (delayOffload) {
                vs = auxTemplateDependencyTable.getEntries(template);
                if (vs == null) {
                    Result other = readValueSet(TEMPLATE_ID_DATA, template, delete);
                    result.copy(other);
                    returnToResultPool(other);
                    if (result.returnCode != DISK_EXCEPTION) {
                        vs = (ValueSet) result.data;
                        if (vs != null) {
                            if (delete == !DELETE && vs.size() <= auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                                result.returnCode = auxTemplateDependencyTable.add(template, vs);
                            }
                        }
                    }
                } else {
                    if (delete == DELETE) {
                        auxTemplateDependencyTable.removeDependency(template);
                        result.returnCode = delValueSet(TEMPLATE_ID_DATA, template);
                    }
                }
            } else {
                Result other = readValueSet(TEMPLATE_ID_DATA, template, delete);
                result.copy(other);
                returnToResultPool(other);
                vs = (ValueSet) result.data;
            }
            if (result.returnCode != DISK_EXCEPTION && vs != null) {
                this.invalidationBuffer.filter(vs);
            }
            result.data = vs;
        }
        return result;
    }
635828
public static TaskTemplate getTaskTemplate(String logicalId) {
        for (int i = 0; i < taskVoCache.size(); i++) {
            TaskTemplate task = taskVoCache.get(i);
            if (logicalId.equals(task.getLogicalId())) {
               return task;
            }
        }
        return null;
    }
355408
public RunParams templateCode(String templateCode) {
        if (templateCode == null) {
            throw new NullPointerException("\"templateCode\" parameter can not be null");
        }
        this.reportTemplate = report.getReportTemplates().get(templateCode);
        if (reportTemplate == null) {
            throw new NullPointerException(String.format("Report template not found for code [%s]", templateCode));
        }
        return this;
    }
754575
public function apiAddTemplate($template_id_short)
    {
        if (!is_string($template_id_short)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr = [
            'template_id_short' => $template_id_short,
        ];

        $res = $this->_post('api_add_template', $queryStr);

        return $res;
    }
719822
public function setTemplateId(string $templateId = null)
    {
        if (!$this->setHeaderFieldModel('TemplateID', $templateId)) {
            $this->getHeaders()->addTextHeader('TemplateID', $templateId);
        }

        return $this;
    }
658921
public function actionDelete($templateId)
    {
        if($template = EmailTemplate::findOne($templateId)) {
            $template->delete();
        }

        return $this->redirect(Url::toRoute('list'));
    }
1015998
protected String formatMessageTemplate(String id, String messageTemplate) {
    return projectCode + "-" + componentId + id + " " + messageTemplate;
  }
76267
public function getTemplateById($template_id)
		{
			$form_data = array(
				'template_id' => $template_id
			);
			$xml = $this->call('gettemplatebyid', $form_data);

			$template = new Template;
			$template
				->setFolderId((int)$xml->folder_id)
				->setTemplateId((int)$xml->template_id)
				->setName((string)$xml->template_name)
				->setSubject((string)$xml->template_subject)
				->setBodyPlain((string)$xml->body_plain)
				->setBodyHtml((string)$xml->body_html)
				->setDescription((string)$xml->template_description);

			return $template;
		}
713736
def get_template(self, template_id):
        ''' 

        '''
        request = self._get_request()
        return request.get(self.TEMPLATE_GET_URL + template_id)
1003397
public function updateDeliverTemplate($templateId, array $deliveryTemplate)
    {
        $result = $this->httpRaw(self::WECHAT_SHOP_DELIVERY_TEMPLATE_UPDATE_URL .
            'access_token=' . $this->getAccessToken(), [
                'template_id' => $templateId,
                'delivery_template' => $deliveryTemplate
            ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success';
    }
1255810
function(id) {
    if (id && (id = id.trim())) {

      // 已经在同步依赖中，则忽略
      if (~this.requires.indexOf(id)) {
        return id;
      }

      if (!~this.asyncs.indexOf(id)) {
        this.asyncs.push(id);
      }

      // 兼容老的用法。
      this.extras.async = this.asyncs.concat();
      return id;
    }
    return false;
  }
155581
public int writeTemplate(String template,
                             ValueSet valueSet) {
        final String methodName = "writeTemplate()";
        int rc = NO_EXCEPTION;
        if (valueSet.size() == 0) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, methodName, "cacheName=" + this.cacheName + " valueSet=0");
        }
        if (!this.disableTemplatesSupport) {
            if (delayOffload) {
                ValueSet vs = auxTemplateDependencyTable.getEntries(template);
                if (vs == null) {
                    if (valueSet.size() <= auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                        Result result = writeValueSetEntry(TEMPLATE_ID_DATA, template, null, valueSet, !ADD_IF_NEW);
                        rc = result.returnCode;
                        boolean bComplete = result.bComplete;
                        returnToResultPool(result);
                        if (rc != DISK_EXCEPTION && !bComplete) {
                            rc = auxTemplateDependencyTable.add(template, valueSet);
                        }
                    } else {
                        rc = writeValueSet(TEMPLATE_ID_DATA, template, valueSet, !ALL); // valueSet may be empty after writeValueSet
                        this.cache.getCacheStatisticsListener().templatesOffloadedToDisk(template);
                    }
                } else {
                    vs.union(valueSet);
                    if (vs.size() > auxTemplateDependencyTable.delayOffloadEntriesLimit) {
                        auxTemplateDependencyTable.removeDependency(template);
                        rc = writeValueSet(TEMPLATE_ID_DATA, template, vs, ALL); // valueSet may be empty after writeValueSet
                        if (rc != NO_EXCEPTION) {
                            valueSet.clear();
                            valueSet.addAll(vs);
                        }
                        this.cache.getCacheStatisticsListener().templatesOffloadedToDisk(template);
                    }
                }
            } else {
                rc = writeValueSet(TEMPLATE_ID_DATA, template, valueSet, !ALL); // valueSet may be empty after writeValueSet
            }
        }
        return rc;
    }
1080587
public static function template_has_related_data($templateid) {
        $params = self::validate_parameters(self::template_has_related_data_parameters(), array(
            'id' => $templateid,
        ));

        $template = api::read_template($params['id']);
        self::validate_context($template->get_context());

        return api::template_has_related_data($params['id']);
    }
1279180
private String loadTemplateFile(String templateName) {
		String name = templateName.replace('.', '/') + ".java";
		InputStream in = SpoonMojoGenerate.class.getClassLoader().getResourceAsStream(name);
		String packageName = templateName.substring(0, templateName.lastIndexOf('.'));
		String fileName = templateName.substring(templateName.lastIndexOf('.') + 1) + ".java";
		try {
			return TemplateLoader.loadToTmpFolder(in, packageName, fileName)
					.getAbsolutePath();
		} catch (IOException e) {
			LogWrapper.warn(spoon, String.format("Template %s cannot be loaded.", templateName), e);
			return null;
		}
	}
436752
function( templateId, parentResolved ){
        var deferred = Q.defer(),
            templatePath = path.resolve( this.templateDir, "../", templateId );

        ( new Template( templateId, templatePath ) )
            .init().done( function( template ){

                // テンプレートが親のテンプレートを持つ場合、
                // まず該当のテンプレートファイルをHTMLファイルとして更新する。
                if( template.parentTemplateId && !parentResolved ){
                    this.updateHTMLFile( templatePath )
                        .then( function(){ return this.registerTemplate( templateId, true ); }.bind( this ) )
                        .then( function( template ){ deferred.resolve( template ); } );
                }
                else {
                    this.templates[ templateId ] = template;
                    deferred.resolve( template );
                }
            }.bind( this ) );

        return deferred.promise;
    }
337401
private int getTemplateTypeIndex(TemplateType key) {
    int maxIndex = Math.min(templateKeys.size(), templateValues.size());
    for (int i = maxIndex - 1; i >= 0; i--) {
      if (isSameKey(templateKeys.get(i), key)) {
        return i;
      }
    }
    return -1;
  }