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


Java ApplicationServiceProvider类代码示例

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


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

示例1: isPublic

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public boolean isPublic(String dataId) throws Exception {
	boolean status = false;
	try {
		CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
				.getApplicationService();
		String query = "select a.protection_group_name protection_group_name from csm_protection_group a, csm_role b, csm_user_group_role_pg c, csm_group d	"
				+ "where a.protection_group_id=c.protection_group_id and b.role_id=c.role_id and c.group_id=d.group_id and "
				+ "d.group_name='"
				+ AccessibilityBean.CSM_PUBLIC_GROUP
				+ "' and b.role_name='"
				+ AccessibilityBean.CSM_READ_ROLE
				+ "'" + " and protection_group_name='" + dataId + "'";
		String[] columns = new String[] { "protection_group_name" };
		Object[] columnTypes = new Object[] { Hibernate.STRING };
		List results = appService.directSQL(query, columns, columnTypes);
		if (results.isEmpty()) {
			return false;
		} else {
			return true;
		}
	} catch (Exception e) {
		String err = "Could not execute direct sql query to check whether data is public.";
		logger.error(err);
		throw new SecurityException(err, e);
	}
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:27,代码来源:SecurityService.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: findProtocolIdsByOwner

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public List<String> findProtocolIdsByOwner(String currentOwner) throws Exception
{
	List<String> protocolIds = new ArrayList<String>();
	DetachedCriteria crit = DetachedCriteria.forClass(Protocol.class)
			.setProjection(Projections.projectionList().add(Projections.property("id")));
	Criterion crit1 = Restrictions.eq("createdBy", currentOwner);
	// in case of copy createdBy is like lijowskim:COPY
	Criterion crit2 = Restrictions.like("createdBy", currentOwner + ":", MatchMode.START);
	crit.add(Expression.or(crit1, crit2));

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	List results = appService.query(crit);
	for(int i = 0; i < results.size(); i++){
		String protocolId = results.get(i).toString();
		if (springSecurityAclService.currentUserHasReadPermission(Long.valueOf(protocolId), SecureClassesEnum.PROTOCOL.getClazz()) ||
			springSecurityAclService.currentUserHasWritePermission(Long.valueOf(protocolId), SecureClassesEnum.PROTOCOL.getClazz())) {
			protocolIds.add(protocolId);
		} else {
			logger.debug("User doesn't have access to protocol of ID: " + protocolId);
		}
	}
	return protocolIds;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:24,代码来源:ProtocolServiceHelper.java

示例4: findPublicationById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public Publication findPublicationById(String publicationId) throws Exception
{
	Long pubId = Long.valueOf(publicationId);
	if (!springSecurityAclService.currentUserHasReadPermission(pubId, SecureClassesEnum.PUBLICATION.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(pubId, SecureClassesEnum.PUBLICATION.getClazz())) {
		throw new NoAccessException("User has no access to the publication " + publicationId);
	}
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(Publication.class).add(Property.forName("id").eq(pubId));
	crit.setFetchMode("authorCollection", FetchMode.JOIN);
	crit.setFetchMode("keywordCollection", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
	List result = appService.query(crit);
	Publication publication = null;
	if (!result.isEmpty()) {
		publication = (Publication) result.get(0);
	}
	return publication;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:21,代码来源:PublicationServiceHelper.java

示例5: findPublicationByKey

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public Publication findPublicationByKey(String keyName, Object keyValue)
		throws Exception {
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider
			.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(Publication.class)
			.add(Property.forName(keyName).eq(keyValue));
	crit.setFetchMode("authorCollection", FetchMode.JOIN);
	crit.setFetchMode("keywordCollection", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
	List result = appService.query(crit);
	Publication publication = null;
	if (!result.isEmpty()) {
		publication = (Publication) result.get(0);
		if (springSecurityAclService.currentUserHasReadPermission(publication.getId(), SecureClassesEnum.PUBLICATION.getClazz()) ||
			springSecurityAclService.currentUserHasWritePermission(publication.getId(), SecureClassesEnum.PUBLICATION.getClazz())) {
			return publication;
		} else {
			throw new NoAccessException();
		}
	}
	return publication;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:24,代码来源:PublicationServiceHelper.java

示例6: findPublicationIdsByOwner

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public List<String> findPublicationIdsByOwner(String currentOwner) throws Exception
{
	List<String> publicationIds = new ArrayList<String>();
	DetachedCriteria crit = DetachedCriteria.forClass(Publication.class).setProjection(Projections.projectionList().add(Projections.property("id")));
	Criterion crit1 = Restrictions.eq("createdBy", currentOwner);
	// in case of copy createdBy is like lijowskim:COPY
	Criterion crit2 = Restrictions.like("createdBy", currentOwner + ":", MatchMode.START);
	crit.add(Expression.or(crit1, crit2));

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	List results = appService.query(crit);
	for(int i = 0; i < results.size(); i++){
		String publicationId = results.get(i).toString();
		Long pubId = Long.valueOf(publicationId);
		if (springSecurityAclService.currentUserHasReadPermission(pubId, SecureClassesEnum.PUBLICATION.getClazz()) ||
			springSecurityAclService.currentUserHasWritePermission(pubId, SecureClassesEnum.PUBLICATION.getClazz())) {
			publicationIds.add(publicationId);
		} else {
			logger.debug("User doesn't have access to publication of ID: " + publicationId);
		}
	}
	return publicationIds;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:24,代码来源:PublicationServiceHelper.java

示例7: main

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        ApplicationService appService = ApplicationServiceProvider
            .getApplicationServiceFromUrl("http://cadsrapi.nci.nih.gov/cadsrapi40/");

        List rList = appService.search(Project.class, new Project());
        for (Iterator resultsIterator = rList.iterator(); resultsIterator.hasNext();) {
            Project project = (Project) resultsIterator.next();
            System.out.println(project.getShortName());
            System.out.println(project.getVersion());

        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:17,代码来源:ApplicationServiceExample.java

示例8: removePublicationFromSample

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
/**
 * Remove sample-publication association for an existing publication.
 *
 * @param sampleId
 * @param publication
 * @param user
 * @throws PublicationException
 *             , NoAccessException
 */
public void removePublicationFromSample(String sampleName, Publication publication) throws PublicationException, NoAccessException
{
	if (SpringSecurityUtil.getPrincipal() == null) {
		throw new NoAccessException();
	}
	try {
		CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
		Sample sample = sampleServiceHelper.findSampleByName(sampleName);
		Collection<Publication> pubs = sample.getPublicationCollection();
		if (pubs != null) {
			pubs.remove(publication);
		}
		appService.saveOrUpdate(sample);
	} catch (Exception e) {
		String err = "Error removing publication from the sample";
		logger.error(err, e);
		throw new PublicationException(err, e);
	}
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:29,代码来源:PublicationServiceLocalImpl.java

示例9: findProtocolByCharacterizationId

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public Protocol findProtocolByCharacterizationId(String characterizationId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(characterizationId), SecureClassesEnum.CHAR.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(characterizationId), SecureClassesEnum.CHAR.getClazz())) {
		new NoAccessException("User has no access to the characterization " + characterizationId);
	}
	Protocol protocol = null;
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	String hql = "select aChar.protocol from gov.nih.nci.cananolab.domain.particle.Characterization aChar where aChar.id="
			+ characterizationId;
	HQLCriteria crit = new HQLCriteria(hql);
	List results = appService.query(crit);
	for (int i = 0; i < results.size(); i++) {
		protocol = (Protocol) results.get(i);
		if (springSecurityAclService.currentUserHasReadPermission(protocol.getId(), SecureClassesEnum.PROTOCOL.getClazz()) ||
			springSecurityAclService.currentUserHasWritePermission(protocol.getId(), SecureClassesEnum.PROTOCOL.getClazz())) {
			return protocol;
		} else {
			logger.debug("User doesn't have access to the protocol " + protocol.getId());
		}
	}
	return protocol;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:24,代码来源:CharacterizationServiceHelper.java

示例10: findExperimentConfigById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public ExperimentConfig findExperimentConfigById(String sampleId, String id) 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 experiment config " + id);
	}
	ExperimentConfig config = null;

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(
			ExperimentConfig.class).add(
			Property.forName("id").eq(new Long(id)));
	crit.setFetchMode("technique", FetchMode.JOIN);
	crit.setFetchMode("instrumentCollection", FetchMode.JOIN);
	List result = appService.query(crit);
	if (!result.isEmpty()) {
		config = (ExperimentConfig) result.get(0);
	}
	return config;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:21,代码来源:CharacterizationServiceHelper.java

示例11: findFindingById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public Finding findFindingById(String findingId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(findingId), SecureClassesEnum.FINDING.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(findingId), SecureClassesEnum.FINDING.getClazz())) {
		new NoAccessException("User has no access to the finding " + findingId);
	}
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Finding.class).add(Property.forName("id").eq(new Long(findingId)));
	crit.setFetchMode("datumCollection", FetchMode.JOIN);
	crit.setFetchMode("datumCollection.conditionCollection", FetchMode.JOIN);
	crit.setFetchMode("fileCollection", FetchMode.JOIN);
	crit.setFetchMode("fileCollection.keywordCollection", FetchMode.JOIN);
	List result = appService.query(crit);
	Finding finding = null;
	if (!result.isEmpty()) {
		finding = (Finding) result.get(0);
		if (finding.getFileCollection() != null) {
			removeUnaccessibleFiles(finding.getFileCollection());
		}
	}
	return finding;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:23,代码来源:CharacterizationServiceHelper.java

示例12: findComposingElementById

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public ComposingElement findComposingElementById(String ceId) throws Exception
{
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(ceId), SecureClassesEnum.COMPOSINGELEMENT.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(ceId), SecureClassesEnum.COMPOSINGELEMENT.getClazz())) {
		new NoAccessException("User has no access to the composing element " + ceId);
	}
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();

	DetachedCriteria crit = DetachedCriteria.forClass(ComposingElement.class).add(Property.forName("id").eq(new Long(ceId)));
	crit.setFetchMode("inherentFunctionCollection", FetchMode.JOIN);
	crit.setFetchMode("inherentFunctionCollection.targetCollection", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
	List result = appService.query(crit);
	ComposingElement ce = null;
	if (!result.isEmpty()) {
		ce = (ComposingElement) result.get(0);
	}
	return ce;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:20,代码来源:CompositionServiceHelper.java

示例13: 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

示例14: findKeywordsBySampleId

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public List<Keyword> findKeywordsBySampleId(String sampleId) throws Exception
{
	// check whether user has access to the sample
	
	if (!springSecurityAclService.currentUserHasReadPermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz()) &&
		!springSecurityAclService.currentUserHasWritePermission(Long.valueOf(sampleId), SecureClassesEnum.SAMPLE.getClazz())) {
		throw new NoAccessException("User doesn't have access to the sample : " + sampleId);
	}
	List<Keyword> keywords = new ArrayList<Keyword>();

	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Sample.class).add(Property.forName("id").eq(new Long(sampleId)));
	crit.setFetchMode("keywordCollection", FetchMode.JOIN);
	List result = appService.query(crit);
	Sample sample = null;
	if (!result.isEmpty()) {
		sample = (Sample) result.get(0);
		keywords.addAll(sample.getKeywordCollection());
	}
	return keywords;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:22,代码来源:SampleServiceHelper.java

示例15: findPrimaryPointOfContactBySampleId

import gov.nih.nci.system.client.ApplicationServiceProvider; //导入依赖的package包/类
public PointOfContact findPrimaryPointOfContactBySampleId(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);
	}
	CaNanoLabApplicationService appService = (CaNanoLabApplicationService) ApplicationServiceProvider.getApplicationService();
	DetachedCriteria crit = DetachedCriteria.forClass(Sample.class).add(
			Property.forName("id").eq(new Long(sampleId)));
	crit.setFetchMode("primaryPointOfContact", FetchMode.JOIN);
	crit.setFetchMode("primaryPointOfContact.organization", FetchMode.JOIN);
	crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
	List results = appService.query(crit);
	PointOfContact poc = null;
	for(int i = 0; i < results.size(); i++){
		Sample sample = (Sample) results.get(i);
		poc = sample.getPrimaryPointOfContact();
	}
	return poc;
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:21,代码来源:SampleServiceHelper.java


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