当前位置: 首页>>代码示例>>Java>>正文


Java ITemplate类代码示例

本文整理汇总了Java中eu.atos.sla.datamodel.ITemplate的典型用法代码示例。如果您正苦于以下问题:Java ITemplate类的具体用法?Java ITemplate怎么用?Java ITemplate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ITemplate类属于eu.atos.sla.datamodel包,在下文中一共展示了ITemplate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(List<ITemplate> templates, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
	StringBuffer tmp = new StringBuffer();
	tmp.append(HEADER);
	tmp.append("<templates>");
	try {
		for (ITemplate template:templates){
			String agreementData = (xmlParser==null)?
					defaultParser.getSerializedData(template.getText()):
						xmlParser.getSerializedData(template.getText()); 
			tmp.append(agreementData);
		}
	} catch (ParserException e) {
		catchedException = e;
	}
	tmp.append("</templates>");
	if (catchedException == null){
		serializedData = tmp.toString().getBytes();
		return  serializedData.length;
	}else
		return 0;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:23,代码来源:TemplateListXmlMessageBodyWriter.java

示例2: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(ITemplate template, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
	if (template.getText()!=null){
		String agreementData;
		try {
			agreementData = (xmlParser == null)?
					defaultParser.getSerializedData(template.getText()):
						xmlParser.getSerializedData(template.getText());
			serializedData =  (new String(HEADER + agreementData)).getBytes();
		} catch (ParserException e) {
			catchedException = e;
		} 
	}else {
		logger.error("Error marshalling data agreement text is null");
		throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
	}
	return  serializedData.length;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:19,代码来源:TemplateXmlMessageBodyWriter.java

示例3: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(List<ITemplate> templates, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
	StringBuffer tmp = new StringBuffer();
	if (jsonParser!=null){
		tmp.append("[");
		try {
			for (ITemplate template:templates){
				tmp.append(jsonParser.getSerializedData(template.getText()));
				tmp.append(",");
			}
			if (tmp.length()>1) tmp.deleteCharAt(tmp.length()-1); // we remove the last ',' we've added
		} catch (ParserException e) {
			catchedException = e;
		}
		tmp.append("]");
		if (catchedException == null){
			serializedData = tmp.toString().getBytes();
			return  serializedData.length;
		}else
			return 0;
	}else{
		catchedException = new Exception("No Agreement JSON Parser defined");
		return 0;
	}
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:26,代码来源:TemplateListJsonMessageBodyWriter.java

示例4: deleteTemplateByUuid

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
public boolean deleteTemplateByUuid(String uuid) throws DBExistsHelperException  {
	logger.debug("StartOf deleteTemplateByUuid uuid:{}", uuid);

	boolean deleted = false;
	List<IAgreement> list = agreementDAO.getByTemplate(uuid);
	if (list.size() > 0) {
		throw new DBExistsHelperException(
				"There are still agreements associated to this template, it cannot be removed");
	}
	
	ITemplate template = templateDAO.getByUuid(uuid);

	if (template != null) {
		deleted = templateDAO.delete(template);
	}
	logger.debug("EndOf deleteTemplateByUuid");
	return deleted;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:19,代码来源:TemplateHelperE.java

示例5: printTemplatesToXML

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
private String printTemplatesToXML(List<ITemplate> templates){
	StringBuilder xmlResponse = new StringBuilder();
	xmlResponse.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	xmlResponse.append("<collection href=\"/templates\">\n");
	xmlResponse.append("<items offset=\"0\" total=\"" + templates.size()
			+ "\">\n");

	for (ITemplate template : templates) {
		xmlResponse.append(template.getText());

	}

	xmlResponse.append("</items>\n");
	xmlResponse.append("</collection>\n");

	return xmlResponse.toString();
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:18,代码来源:TemplateHelper.java

示例6: getTemplates

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
public String getTemplates()  throws HelperException{
	logger.debug("StartOf getTemplates");
	List<ITemplate> templates = new ArrayList<ITemplate>();

	templates = this.templateDAO.getAll();

	if (templates.size() != 0){
		String str = printTemplatesToXML(templates); 
		logger.debug("EndOf getTemplates");
		return str;
	}else{
		logger.debug("EndOf getTemplates");
		throw new HelperException(Code.DB_DELETED, "There are no templates in the SLA Repository Database");
	}

}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:17,代码来源:TemplateHelper.java

示例7: deleteTemplateByUuid

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
public boolean deleteTemplateByUuid(String uuid) throws HelperException  {
	logger.debug("StartOf deleteTemplateByUuid uuid:"+uuid);

	boolean deleted = false;
	try{
		List<IAgreement> list = agreementDAO.getByTemplate(uuid);
		if (list.size()>0) throw new HelperException(Code.DB_EXIST, "There are still agreements associated to this template, it cannot be removed");
		ITemplate template = this.templateDAO.getByUuid(uuid);

		if (template != null) {
			deleted = this.templateDAO.delete(template);
		}

		logger.debug("EndOf deleteTemplateByUuid");
		return deleted;
	} catch (Throwable e) {
		logger.error("Error in deleteTemplateByUuid " , e);
		throw new HelperException(Code.INTERNAL, "Error when deleting template:" + e.getMessage() );
	}

}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:22,代码来源:TemplateHelper.java

示例8: deleteByProviderUUID

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
public boolean deleteByProviderUUID(String providerUUID) throws DBExistsHelperException{
	logger.debug("StartOf deleteByProviderUUID providerUUID:{}", providerUUID);
	
	boolean deleted = false;
	List<ITemplate> listTemplates = templateDAO.search(providerUUID, null);
	if ((listTemplates==null) || listTemplates.size()>0){ 
		logger.debug("Templates exists associated to providerUUID {}, provider will not be removed", providerUUID);
		throw new DBExistsHelperException("Template with provider uuid:"
				+ providerUUID +" exists in the SLA Repository Database. Provider cannot be removed.");
	}else{
		List<IAgreement> listAgreements = agreementDAO.getByProvider(providerUUID);
		if ((listAgreements==null) || listAgreements.size()>0){ 
			logger.debug("Agreements exists associated to providerUUID {}, provider will not be removed", 
					providerUUID);
			throw new DBExistsHelperException("Agreements with provider uuid:"
					+ providerUUID +" exists in the SLA Repository Database. Provider cannot be removed.");
		}else{
			IProvider provider = providerDAO.getByUUID(providerUUID);
			if (provider!=null)
				deleted = this.providerDAO.delete(provider);
		}
	}

	logger.debug("EndOf deleteByProviderUUID");
	return deleted;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:27,代码来源:ProviderHelperE.java

示例9: search

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public List<ITemplate> search(String providerId, String []serviceIds) {
	TypedQuery<ITemplate> query = entityManager.createNamedQuery(
			Template.QUERY_SEARCH, ITemplate.class);
	query.setParameter("providerId", providerId);
	query.setParameter("serviceIds", (serviceIds!=null)?Arrays.asList(serviceIds):null);
	query.setParameter("flagServiceIds", (serviceIds!=null)?"flag":null);
	logger.debug("providerId:{} - serviceIds:{}" , providerId, (serviceIds!=null)?Arrays.asList(serviceIds):null);
	List<ITemplate> templates = new ArrayList<ITemplate>();
	templates = (List<ITemplate>) query.getResultList();

	if (templates != null) {
		logger.debug("Number of templates:" + templates.size());
	} else {
		logger.debug("No Result found.");
	}

	return templates;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:20,代码来源:TemplateDAOJpa.java

示例10: getByAgreement

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public List<ITemplate> getByAgreement(String agreement) {

	TypedQuery<ITemplate> query = entityManager.createNamedQuery(
			Template.QUERY_FIND_BY_AGREEMENT, ITemplate.class);
	query.setParameter("agreement", agreement);
	List<ITemplate> templates = new ArrayList<ITemplate>();
	templates = (List<ITemplate>) query.getResultList();

	if (templates != null) {
		logger.debug("Number of templates:" + templates.size());
	} else {
		logger.debug("No Result found.");
	}

	return templates;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:18,代码来源:TemplateDAOJpa.java

示例11: getAll

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public List<ITemplate> getAll() {

	TypedQuery<ITemplate> query = entityManager.createNamedQuery(
			Template.QUERY_FIND_ALL, ITemplate.class);
	List<ITemplate> templates = new ArrayList<ITemplate>();
	templates = (List<ITemplate>) query.getResultList();
	if (templates != null) {
		logger.debug("Number of templates:" + templates.size());
	} else {
		logger.debug("No Result found.");
	}

	return templates;

}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:17,代码来源:TemplateDAOJpa.java

示例12: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(List<ITemplate> templates, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
    StringBuffer tmp = new StringBuffer();
    tmp.append(HEADER);
    tmp.append("<templates>");
    try {
        for (ITemplate template:templates){
            String agreementData = (xmlParser==null)?
                    defaultParser.getSerializedData(template.getText()):
                        xmlParser.getSerializedData(template.getText()); 
            tmp.append(agreementData);
        }
    } catch (ParserException e) {
        catchedException = e;
    }
    tmp.append("</templates>");
    if (catchedException == null){
        serializedData = tmp.toString().getBytes();
        return  serializedData.length;
    }else
        return 0;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:23,代码来源:TemplateListXmlMessageBodyWriter.java

示例13: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(ITemplate template, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
    if (template.getText()!=null){
        String agreementData;
        try {
            agreementData = (xmlParser == null)?
                    defaultParser.getSerializedData(template.getText()):
                        xmlParser.getSerializedData(template.getText());
            serializedData =  (new String(HEADER + agreementData)).getBytes();
        } catch (ParserException e) {
            catchedException = e;
        } 
    }else {
        logger.error("Error marshalling data agreement text is null");
        throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
    }
    return  serializedData.length;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:19,代码来源:TemplateXmlMessageBodyWriter.java

示例14: getSize

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
@Override
public long getSize(List<ITemplate> templates, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) {
    StringBuffer tmp = new StringBuffer();
    if (jsonParser!=null){
        tmp.append("[");
        try {
            for (ITemplate template:templates){
                tmp.append(jsonParser.getSerializedData(template.getText()));
                tmp.append(",");
            }
            if (tmp.length()>1) tmp.deleteCharAt(tmp.length()-1); // we remove the last ',' we've added
        } catch (ParserException e) {
            catchedException = e;
        }
        tmp.append("]");
        if (catchedException == null){
            serializedData = tmp.toString().getBytes();
            return  serializedData.length;
        }else
            return 0;
    }else{
        catchedException = new Exception("No Agreement JSON Parser defined");
        return 0;
    }
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:26,代码来源:TemplateListJsonMessageBodyWriter.java

示例15: deleteTemplateByUuid

import eu.atos.sla.datamodel.ITemplate; //导入依赖的package包/类
public boolean deleteTemplateByUuid(String uuid) throws DBExistsHelperException  {
    logger.debug("StartOf deleteTemplateByUuid uuid:{}", uuid);

    boolean deleted = false;
    List<IAgreement> list = agreementDAO.getByTemplate(uuid);
    if (list.size() > 0) {
        throw new DBExistsHelperException(
                "There are still agreements associated to this template, it cannot be removed");
    }
    
    ITemplate template = templateDAO.getByUuid(uuid);

    if (template != null) {
        deleted = templateDAO.delete(template);
    }
    logger.debug("EndOf deleteTemplateByUuid");
    return deleted;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:19,代码来源:TemplateHelperE.java


注:本文中的eu.atos.sla.datamodel.ITemplate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。