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


Java Provider类代码示例

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


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

示例1: getProviderByUUID

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
public String getProviderByUUID(String uuid) throws HelperException {
	logger.debug("StartOf getProviderByUUID uuid:"+uuid);
	try{
		IProvider provider = new Provider();

		provider = this.providerDAO.getByUUID(uuid);
		String str = null;
		if (provider != null)
			str = printProviderToXML(provider);
		logger.debug("EndOf getProviderByUUID");
		return str;
	} catch (JAXBException e) {
		logger.error("Error in getEnforcementJobByUUID " , e);
		throw new HelperException(Code.PARSER, "Error when creating enforcementJob parsing file:" + e.getMessage() );
	}
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:17,代码来源:ProviderHelper.java

示例2: saveAgreement

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
private IAgreement saveAgreement() {
	Provider provider = new Provider(null, UUID.randomUUID().toString(), "Provider 2");
	
	Template template = new Template();
	template.setServiceId("service");
	template.setText("asadsad");
	template.setUuid(UUID.randomUUID().toString());
	template.setProvider(provider);
	providerDao.save(provider);
	templateDao.save(template);
	
	
	IAgreement agreement = newAgreement(provider, template);
	IAgreement agreementStored = agreementDao.save(agreement);
	return agreementStored;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:17,代码来源:EnforcementServiceTest.java

示例3: getById

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Test
public void getById() {

	String uuid = UUID.randomUUID().toString();

	IProvider provider = new Provider();
	provider.setName("Provider10");
	provider.setUuid(uuid);

	IProvider saved = new Provider();
	try {
		saved = providerDAO.save(provider);
	} catch (Exception e) {
		fail();
	}


	assertEquals(uuid, saved.getUuid());
	assertEquals("Provider10", saved.getName());

	IProvider nullProvider = providerDAO.getById(new Long(30000));
	assertEquals(null, nullProvider);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:24,代码来源:ProviderDAOJpaTest.java

示例4: save

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Test
public void save() {

	String uuid = UUID.randomUUID().toString();

	IProvider provider = new Provider();
	provider.setName("Provider3");
	provider.setUuid(uuid);

	@SuppressWarnings("unused")
	IProvider saved = new Provider();
	try {
		saved = providerDAO.save(provider);
	} catch (Exception e) {
		
	}
	assert(true);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:19,代码来源:ProviderDAOJpaTest.java

示例5: getProviderByUUID

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
public String getProviderByUUID(String uuid) throws HelperException {
    logger.debug("StartOf getProviderByUUID uuid:"+uuid);
    try{
        IProvider provider = new Provider();

        provider = this.providerDAO.getByUUID(uuid);
        String str = null;
        if (provider != null)
            str = printProviderToXML(provider);
        logger.debug("EndOf getProviderByUUID");
        return str;
    } catch (JAXBException e) {
        logger.error("Error in getEnforcementJobByUUID " , e);
        throw new HelperException(Code.PARSER, "Error when creating enforcementJob parsing file:" + e.getMessage() );
    }
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:17,代码来源:ProviderHelper.java

示例6: saveAgreement

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
private IAgreement saveAgreement() {
    Provider provider = new Provider(null, UUID.randomUUID().toString(), "Provider 2");
    
    Template template = new Template();
    template.setServiceId("service");
    template.setText("asadsad");
    template.setUuid(UUID.randomUUID().toString());
    template.setProvider(provider);
    providerDao.save(provider);
    templateDao.save(template);
    
    
    IAgreement agreement = newAgreement(provider, template);
    IAgreement agreementStored = agreementDao.save(agreement);
    return agreementStored;
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:17,代码来源:EnforcementServiceTest.java

示例7: getById

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Test
public void getById() {

    String uuid = UUID.randomUUID().toString();

    IProvider provider = new Provider();
    provider.setName("Provider10");
    provider.setUuid(uuid);

    IProvider saved = new Provider();
    try {
        saved = providerDAO.save(provider);
    } catch (Exception e) {
        fail();
    }


    assertEquals(uuid, saved.getUuid());
    assertEquals("Provider10", saved.getName());

    IProvider nullProvider = providerDAO.getById(new Long(30000));
    assertEquals(null, nullProvider);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:24,代码来源:ProviderDAOJpaTest.java

示例8: save

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Test
public void save() {

    String uuid = UUID.randomUUID().toString();

    IProvider provider = new Provider();
    provider.setName("Provider3");
    provider.setUuid(uuid);

    @SuppressWarnings("unused")
    IProvider saved = new Provider();
    try {
        saved = providerDAO.save(provider);
    } catch (Exception e) {
        
    }
    assert(true);
}
 
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:19,代码来源:ProviderDAOJpaTest.java

示例9: createProvider

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
public String createProvider(HttpHeaders hh, String uriInfo,
		String payload) throws HelperException {
	logger.debug("StartOf createProvider payload:"+payload);
	try {
		eu.atos.sla.parser.data.Provider providerXML = null;

		JAXBContext jaxbContext = JAXBContext.newInstance(eu.atos.sla.parser.data.Provider.class);
		Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
		providerXML = (eu.atos.sla.parser.data.Provider) jaxbUnmarshaller.unmarshal(new StringReader(payload));

		IProvider provider = new Provider();
		
		IProvider stored = new Provider();

		if (providerXML != null) {

			if (!doesProviderExistsInRepository(providerXML.getUuid())) {
				provider = modelConverter.getProviderFromProviderXML(providerXML);
				stored = providerDAO.save(provider);
			} else {
				throw new HelperException(Code.DB_EXIST, "Provider with id:"
						+ providerXML.getUuid()
						+ " already exists in the SLA Repository Database");
			}
		}

		if (stored != null) {
			logger.debug("EndOf createProvider");
			String location = uriInfo + "/" + stored.getUuid();
			return location;
		} else
			logger.debug("EndOf createProvider");
			throw new HelperException(Code.INTERNAL, "Error when creating provider the SLA Repository Database");
	} catch (JAXBException e) {
		logger.error("Error in createProvider " , e);
		throw new HelperException(Code.PARSER, "Error when creating provider parsing file:" + e.getMessage() );
	}
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:39,代码来源:ProviderHelper.java

示例10: newProvider

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
private IProvider newProvider() {
	IProvider provider = new Provider();
	provider.setName("provider-name");
	provider.setUuid("provider-uuid");
	
	return provider;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:8,代码来源:AgreementEnforcementTest.java

示例11: testGetEnforcementJobByAgreementId

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Test
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void testGetEnforcementJobByAgreementId() throws Exception {
	Provider provider = new Provider(null, UUID.randomUUID().toString(),
			"Provider 2");
	
	Template template = new Template();
	template.setServiceId("service");
	template.setText("asadsad");
	template.setUuid(UUID.randomUUID().toString());
	template.setProvider(provider);
	providerDao.save(provider);
	templateDao.save(template);
	
	
	IAgreement agreement = newAgreement(provider, template);
	agreementDao.save(agreement);
	
	IEnforcementJob expected = newEnforcementJob(agreement);
	enforcementJobDao.save(expected);
	
	IEnforcementJob actual;
	
	actual = service.getEnforcementJobByAgreementId(agreement.getAgreementId());
	assertTrue(equalJobs(expected, actual));
	
	actual = service.getEnforcementJobByAgreementId("noexiste");
	assertNull(actual);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:30,代码来源:EnforcementServiceTest.java

示例12: newAgreement

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
private Agreement newAgreement(Provider provider, Template template) {
	Agreement agreement = new Agreement();
	agreement.setAgreementId(UUID.randomUUID().toString());
	agreement.setProvider(provider);
	agreement.setTemplate(template);
	return agreement;
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:8,代码来源:EnforcementServiceTest.java

示例13: newAgreement

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
public static IAgreement newAgreement(List<IGuaranteeTerm> terms) {
	
	return newAgreement(
			UUID.randomUUID().toString(),
			new Provider(),
			"",
			terms
			);
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:10,代码来源:TestAgreementFactory.java

示例14: getLastProvider

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Override
public IProvider getLastProvider() {
	Query query = entityManager
			.createQuery("SELECT p FROM Provider p order by id DESC");
	query.setMaxResults(1);
	return (Provider) query.getSingleResult();
}
 
开发者ID:Atos-FiwareOps,项目名称:sla-framework,代码行数:8,代码来源:ProviderDAOJpa.java

示例15: getAll

import eu.atos.sla.datamodel.bean.Provider; //导入依赖的package包/类
@Override
public List<IProvider> getAll() {
	TypedQuery<IProvider> query = entityManager.createNamedQuery(
			Provider.QUERY_FIND_ALL, IProvider.class);
	List<IProvider> providers = null;
	providers = query.getResultList();

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

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


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