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


Java ApplicationServiceProvider.getApplicationService方法代码示例

本文整理汇总了Java中gov.nih.nci.system.client.ApplicationServiceProvider.getApplicationService方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationServiceProvider.getApplicationService方法的具体用法?Java ApplicationServiceProvider.getApplicationService怎么用?Java ApplicationServiceProvider.getApplicationService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nih.nci.system.client.ApplicationServiceProvider的用法示例。


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

示例1: findSampleBasicById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public Sample findSampleBasicById(String sampleId) throws Exception {
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz())) {
		throw new NoAccessException("User has no access to the sample " + sampleId);
	}
	Sample sample = null;
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
			.getApplicationService();
	
	DetachedCriteria crit = DetachedCriteria.forClass(Sample.class).add(
			Property.forName("id").eq(new Long(sampleId)));

	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);

	List result = appService.query(crit);
	if (!result.isEmpty()) {
		sample = (Sample) result.get(0);
	}
	return sample;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:21,代码来源:SampleServiceHelper.java

示例2: findFileByProtocolId

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public File findFileByProtocolId(String protocolId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(protocolId), SecureClassesEnum.PROTOCOL.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(protocolId), SecureClassesEnum.PROTOCOL.getClazz())) {
		new NoAccessException("User has no access to the protocol " + protocolId);
	}
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	HQLCriteria crit = new HQLCriteria("select aProtocol.file from gov.nih.nci.cananolab.domain.common.Protocol aProtocol where aProtocol.id = "
					+ protocolId);
	List result = appService.query(crit);
	File file = null;
	if (!result.isEmpty()) {
		file = (File) result.get(0);
	}
	return file;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:17,代码来源:ProtocolServiceHelper.java

示例3: testSearch

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public void testSearch() throws Exception
{
	//Application Service retrieval for secured system
	//ApplicationService appService = ApplicationServiceProvider.getApplicationService("userId","password");
	
	ApplicationService appService = ApplicationServiceProvider.getApplicationService();
	Collection<Class> classList = getClasses();
	for(Class klass:classList)
	{
		Object o = klass.newInstance();
		System.out.println("Searching for "+klass.getName());
		try
		{
			Collection results = appService.search(klass, o);
			for(Object obj : results)
			{
				printObject(obj, klass);
				break;
			}
		}catch(Exception e)
		{
			System.out.println(">>>"+e.getMessage());
		}
	}
}
 
开发者ID:NCIP,项目名称:digital-model-repository,代码行数:26,代码来源:TestClient.java

示例4: findChemicalAssociationById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public ChemicalAssociation findChemicalAssociationById(String sampleId, String assocId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz())) {
		new NoAccessException("User has no access to the chemical association " + assocId);
	}
	ChemicalAssociation assoc = null;

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(ChemicalAssociation.class).add(Property.forName("id").eq(new Long(assocId)));
	crit.setFetchMode("fileCollection", FetchMode.JOIN);
	crit.setFetchMode("fileCollection.keywordCollection", FetchMode.JOIN);
	crit.setFetchMode("associatedElementA", FetchMode.JOIN);
	crit.setFetchMode("associatedElementA.nanomaterialEntity", FetchMode.JOIN);
	crit.setFetchMode("associatedElementB", FetchMode.JOIN);
	crit.setFetchMode("associatedElementB.nanomaterialEntity", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);

	List result = appService.query(crit);
	if (!result.isEmpty()) {
		assoc = (ChemicalAssociation) result.get(0);
	}
	return assoc;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:26,代码来源:CompositionServiceHelper.java

示例5: findInstrumentBy

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
private Instrument findInstrumentBy(String type, String manufacturer,
		String modelName) throws Exception 
{
	Instrument instrument = null;

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Instrument.class);
	crit.add(Restrictions.eq("type", type).ignoreCase());
	crit.add(Restrictions.eq("manufacturer", manufacturer).ignoreCase());
	crit.add(Restrictions.eq("modelName", modelName).ignoreCase());
	List results = appService.query(crit);
	for (int i = 0; i < results.size(); i++) {
		instrument = (Instrument) results.get(i);
	}
	return instrument;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:17,代码来源:CharacterizationServiceLocalImpl.java

示例6: findExperimentConfigsByCharacterizationId

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public List<ExperimentConfig> findExperimentConfigsByCharacterizationId(String charId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(charId), SecureClassesEnum.CHAR.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(charId), SecureClassesEnum.CHAR.getClazz())) {
		new NoAccessException("User has no access to the characterization " + charId);
	}
	List<ExperimentConfig> configs = new ArrayList<ExperimentConfig>();
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(
			Characterization.class).add(
			Property.forName("id").eq(new Long(charId)));
	crit.setFetchMode("experimentConfigCollection", FetchMode.JOIN);
	crit.setFetchMode("experimentConfigCollection.technique",
			FetchMode.JOIN);
	crit.setFetchMode("experimentConfigCollection.instrumentCollection",
			FetchMode.JOIN);
	List result = appService.query(crit);
	if (!result.isEmpty()) {
		Characterization achar = (Characterization) result.get(0);
		configs.addAll(achar.getExperimentConfigCollection());
	}
	return configs;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:24,代码来源:CharacterizationServiceHelper.java

示例7: getAllSamples

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public List<String> getAllSamples() throws Exception {
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
			.getApplicationService();
	HQLCriteria crit = new HQLCriteria(
			"select id from gov.nih.nci.cananolab.domain.particle.Sample");
	List results = appService.query(crit);
	List<String> publicIds = new ArrayList<String>();
	for(int i = 0; i< results.size(); i++){
		String id = (String) results.get(i).toString();
		publicIds.add(id);	
	}
	return publicIds;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:14,代码来源:SampleServiceHelper.java

示例8: findCharacterizationById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public Characterization findCharacterizationById(String charId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(charId), SecureClassesEnum.CHAR.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(charId), SecureClassesEnum.CHAR.getClazz())) {
		new NoAccessException("User has no access to the characterization " + charId);
	}
	Characterization achar = null;
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Characterization.class).add(Property.forName("id").eq(new Long(charId)));
	// fully load characterization
	crit.setFetchMode("pointOfContact", FetchMode.JOIN);
	crit.setFetchMode("pointOfContact.organization", FetchMode.JOIN);
	crit.setFetchMode("protocol", FetchMode.JOIN);
	crit.setFetchMode("protocol.file", FetchMode.JOIN);
	crit.setFetchMode("protocol.file.keywordCollection", FetchMode.JOIN);
	crit.setFetchMode("experimentConfigCollection", FetchMode.JOIN);
	crit.setFetchMode("experimentConfigCollection.technique", FetchMode.JOIN);
	crit.setFetchMode("experimentConfigCollection.instrumentCollection", FetchMode.JOIN);
	crit.setFetchMode("findingCollection", FetchMode.JOIN);
	crit.setFetchMode("findingCollection.datumCollection", FetchMode.JOIN);
	crit.setFetchMode("findingCollection.datumCollection.conditionCollection", FetchMode.JOIN);
	crit.setFetchMode("findingCollection.fileCollection", FetchMode.JOIN);
	crit.setFetchMode("findingCollection.fileCollection.keywordCollection", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);

	List result = appService.query(crit);
	if (!result.isEmpty()) {
		achar = (Characterization) result.get(0);
		checkAssociatedVisibility(achar);
	}
	return achar;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:33,代码来源:CharacterizationServiceHelper.java

示例9: getGroupRole

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public String getGroupRole(String protectedData, String groupName)
		throws SecurityException {
	String query = "select distinct r.role_name "
			+ "from csm_user_group_role_pg ugrp, csm_protection_group pg, csm_group g, csm_role r "
			+ "where ugrp.protection_group_id=pg.protection_group_id  "
			+ "and ugrp.group_id=g.group_id "
			+ "and ugrp.role_id=r.role_id " + "and g.group_name='"
			+ groupName + "' " + "and pg.protection_group_name='"
			+ protectedData + "'";
	String roleName = null;
	try {
		CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
				.getApplicationService();
		String[] columns = new String[] { "role_name" };
		Object[] columnTypes = new Object[] { Hibernate.STRING };
		List results = appService.directSQL(query, columns, columnTypes);
		for (int i = 0; i < results.size(); i++) {
			roleName = results.get(i).toString();
		}
	} catch (Exception e) {
		logger
				.error(
						"Error in getting existing role for the given data and given group name from CSM database",
						e);
		throw new SecurityException();
	}

	return roleName;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:30,代码来源:SecurityService.java

示例10: getNumberOfPublicCharacterizations

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public int getNumberOfPublicCharacterizations(String characterizationClassName) throws Exception
{
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(ClassUtils.getFullClass(characterizationClassName))
			.setProjection(Projections.distinct(Property.forName("id")));
	List results = appService.query(crit);
	int count = 0;
	for (int i = 0; i < results.size(); i++) {
		Long id = Long.valueOf(results.get(i).toString());
		if (springSecurityAclService.checkObjectPublic(id, SecureClassesEnum.CHAR.getClazz()))
			count++;
	}
	return count;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:15,代码来源:CharacterizationServiceHelper.java

示例11: getAllOtherObjectTypes

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public static SortedSet<String> getAllOtherObjectTypes(String fullClassName)
		throws BaseException {
	SortedSet<String> types = new TreeSet<String>();
	try {
		CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
				.getApplicationService();
		Class clazz = Class.forName(fullClassName);
		List results = appService.getAll(clazz);
		for (int i = 0; i < results.size(); i++) {
			if (results.get(i) instanceof OtherFunction) {
				types.add(((OtherFunction) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherNanomaterialEntity) {
				types.add(((OtherNanomaterialEntity) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherNanomaterialEntity) {
				types.add(((OtherNanomaterialEntity) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherFunctionalizingEntity) {
				types.add(((OtherFunctionalizingEntity) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherChemicalAssociation) {
				types.add(((OtherChemicalAssociation) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherCharacterization) {
				types.add(((OtherCharacterization) results.get(i)).getAssayCategory());
			} else if (results.get(i) instanceof OtherFunction) {
				types.add(((OtherFunction) results.get(i)).getType());
			} else if (results.get(i) instanceof OtherTarget) {
				types.add(((OtherTarget) results.get(i)).getType());
			}
		}
		return types;
	} catch (Exception e) {
		String err = "Error in retrieving other object types for: "
				+ fullClassName;
		logger.error(err, e);
		throw new CompositionException(err, e);
	}
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:36,代码来源:LookupService.java

示例12: findSampleNamesBy

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
/**
 * search sampleNames based on sample name str. The str can contain just a
 * partial sample name or multiple partial names one per line
 * 
 * @param nameStr
 * @return
 * @throws Exception
 */
public List<String> findSampleNamesBy(String nameStr) throws Exception {
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(Sample.class);
	if (!StringUtils.isEmpty(nameStr)) {
		// split nameStr to multiple words if needed
		List<String> nameStrs = StringUtils.parseToWords(nameStr, "\n");
		if (nameStrs.size() == 1) {
			crit.add(Restrictions.ilike("name", nameStr, MatchMode.ANYWHERE));
		} else {
			Disjunction disjunction = Restrictions.disjunction();
			for (String str : nameStrs) {
				Criterion strCrit = Restrictions.ilike("name", str, MatchMode.ANYWHERE);
				disjunction.add(strCrit);
			}
			crit.add(disjunction);
		}
	}
	List results = appService.query(crit);
	List<String> sampleNames = new ArrayList<String>();
	for(int i = 0; i < results.size(); i++){
		Sample sample = (Sample) results.get(i);
		if (springSecurityAclService.currentUserHasReadPermission(sample.getId(), SecureClassesEnum.SAMPLE.getClazz()) ||
			springSecurityAclService.currentUserHasWritePermission(sample.getId(), SecureClassesEnum.SAMPLE.getClazz())) {
			sampleNames.add(sample.getName());
		} else {
			logger.debug("User doesn't have access to sample of name: " + sample.getName());
		}
	}
	return sampleNames;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:40,代码来源:SampleServiceHelper.java

示例13: findFileById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
/**
 * Load the file for the given fileId from the database
 *
 * @param fileId
 * @return
 */
public File findFileById(String fileId) throws Exception {
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(File.class).add(Property.forName("id").eq(new Long(fileId)));
	crit.setFetchMode("keywordCollection", FetchMode.JOIN);
	List result = appService.query(crit);
	File file = null;
	if (!result.isEmpty()) {
		file = (File) result.get(0);
	}
	return file;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:19,代码来源:BaseServiceLocalImpl.java

示例14: findOrganizationByName

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public Organization findOrganizationByName(String orgName) throws Exception {
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
			.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Organization.class);
	crit.add(Restrictions.eq("name", orgName).ignoreCase());
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);

	List results = appService.query(crit);
	Organization org = null;
	for(int i = 0; i < results.size(); i++){
		org = (Organization) results.get(i);
	}
	return org;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:15,代码来源:SampleServiceHelper.java

示例15: saveOtherType

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入方法依赖的package包/类
public static void saveOtherType(String lookupName, String otherAttribute,
		String otherAttributeValue) throws BaseException {
	try {
		CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
				.getApplicationService();
		DetachedCriteria crit = DetachedCriteria
				.forClass(CommonLookup.class);
		//skip saving other type if other type has not been entered.
		if (otherAttributeValue.equalsIgnoreCase("Other")) {
			return;
		}
		crit.add(Property.forName("name").eq(lookupName)).add(
				Property.forName("attribute").eq(otherAttribute)).add(
				Property.forName("value").eq(otherAttributeValue));
		Integer number = appService.getQueryRowCount(crit,
				CommonLookup.class.getCanonicalName());
		if (number == 0) {
			CommonLookup lookup = new CommonLookup();
			lookup.setName(lookupName);
			lookup.setAttribute(otherAttribute);
			lookup.setValue(otherAttributeValue);
			appService.saveOrUpdate(lookup);
		}

	} catch (Exception e) {
		String err = "Error in saving other attribute types for "
				+ lookupName;
		logger.error(err, e);
		throw new BaseException(err, e);
	}
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:32,代码来源:LookupService.java


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