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


Java NotFoundException类代码示例

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


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

示例1: readAclById

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@Override
public Acl readAclById(ObjectIdentity object, List<Sid> sids) throws NotFoundException {
    Map<ObjectIdentity, Acl> map = readAclsById(Arrays.asList(object), sids);
    Assert.isTrue(map.containsKey(object), "There should have been an Acl entry for ObjectIdentity " + object);

    return (Acl) map.get(object);
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:8,代码来源:JpaMutableAclService.java

示例2: deletePermis

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
public void deletePermis(
		Long objectIdentifier,
		Class<?> objectClass,
		Long permisId) {
	try {
		ObjectIdentity oid = new ObjectIdentityImpl(objectClass, objectIdentifier);
		Acl acl = aclService.readAclById(oid);
		for (AccessControlEntry ace: acl.getEntries()) {
			if (permisId.equals(ace.getId())) {
				assignarPermisos(
						ace.getSid(),
						objectClass,
						objectIdentifier,
						new Permission[] {},
						true);
			}
		}
	} catch (NotFoundException nfex) {
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:21,代码来源:PermisosHelper.java

示例3: readAclsById

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@Override
public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects,
		List<Sid> sids) throws NotFoundException {
	Map<ObjectIdentity, Acl> result = doLookup(objects, sids);

	// Check every requested object identity was found (throw
	// NotFoundException if needed)
	for (ObjectIdentity oid : objects) {
		if (!result.containsKey(oid)) {
			throw new NotFoundException("Unable to find ACL information for object identity '" + oid + "'");
		}
	}

	return result;

}
 
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:17,代码来源:MongodbAclService.java

示例4: readAclsById

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
 * Read Acls By Object Identities and Sids
 */
@Override
public Map<ObjectIdentity, Acl> readAclsById(List<ObjectIdentity> objects,
		List<Sid> sids) throws NotFoundException {
	Map<ObjectIdentity, Acl> result = lookupStrategy.readAclsById(objects,
			sids);

	// Check every requested object identity was found (throw
	// NotFoundException if needed)
	for (ObjectIdentity oid : objects) {
		if (!result.containsKey(oid)) {
			throw new NotFoundException(
					"Unable to find ACL information for object identity '"
							+ oid + "'");
		}
	}

	return result;
}
 
开发者ID:shazin,项目名称:spring-security-acl-neo4j,代码行数:22,代码来源:Neo4jAclService.java

示例5: updateAcl

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
 * This implementation will simply delete all ACEs in the database and recreate them on each invocation of
 * this method. A more comprehensive implementation might use dirty state checking, or more likely use ORM
 * capabilities for create, update and delete operations of {@link MutableAcl}.
 */
@Override
public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException {
    Assert.notNull(acl.getId(), "Object Identity doesn't provide an identifier");

    // Delete this ACL's ACEs in the acl_entry table
    aclDao.deleteEntries(retrieveObjectIdentityPrimaryKey(acl.getObjectIdentity()));

    // Create this ACL's ACEs in the acl_entry table
    createEntries(acl);

    // Change the mutable columns in acl_object_identity
    updateObjectIdentity(acl);

    // Clear the cache, including children
    clearCacheIncludingChildren(acl.getObjectIdentity());

    // Retrieve the ACL via superclass (ensures cache registration, proper retrieval etc)
    return (MutableAcl) readAclById(acl.getObjectIdentity());
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:25,代码来源:JpaMutableAclService.java

示例6: getAclEntriesGroupedBySid

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public Map<Sid, List<AccessControlEntry>> getAclEntriesGroupedBySid(
		Serializable id,
		Class clazz) {
	ObjectIdentity oid = new ObjectIdentityImpl(clazz, id);
	try {
		Map<Sid, List<AccessControlEntry>> resposta = new HashMap<Sid, List<AccessControlEntry>>();
		List<AccessControlEntry> aces = aclServiceDao.findAclsByOid(oid);
		if (aces != null) {
			for (AccessControlEntry ace: aces) {
				List<AccessControlEntry> entriesForSid = resposta.get(ace.getSid());
				if (entriesForSid == null) {
					entriesForSid = new ArrayList<AccessControlEntry>();
					resposta.put(ace.getSid(), entriesForSid);
				}
				entriesForSid.add(ace);
			}
		}
		return resposta;
	} catch (NotFoundException ex) {
		return null;
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:24,代码来源:PermissionService.java

示例7: permisosEsborrar

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/permisos/expedientTipusEsborrar")
public String permisosEsborrar(
		HttpServletRequest request,
		@ModelAttribute("command") PermisosObjecteCommand command) {
	try {
		permissionService.deleteAllPermissionsForSid(
				command.getNom(),
				command.isUsuari(),
				command.getId(),
				ExpedientTipus.class);
       	missatgeInfo(request, getMessage("info.permisos.tipusexp.esborrat") );
	} catch (NotFoundException nfex) {
		missatgeError(request, getMessage("error.esborrar.permisos.tipusexp.permis"));
       	logger.error("No s'han pogut esborrar els permisos. No té permís", nfex);
	} catch (Exception ex) {
       	missatgeError(request, getMessage("error.esborrar.permisos.tipusexp"), ex.getLocalizedMessage());
       	logger.error("No s'han pogut esborrar els permisos", ex);
       }
       return "redirect:/permisos/expedientTipus.html?id=" + command.getId();
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:21,代码来源:PermisosExpedientTipusController.java

示例8: permisosEsborrar

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/permisos/entornEsborrar")
public String permisosEsborrar(
		HttpServletRequest request,
		@ModelAttribute("command") PermisosObjecteCommand command) {
	try {
		permissionService.deleteAllPermissionsForSid(
				command.getNom(),
				command.isUsuari(),
				command.getId(),
				Entorn.class);
       	missatgeInfo(request, getMessage("info.permisos.entorn.esborrat") );
	} catch (NotFoundException nfex) {
		missatgeError(request, getMessage("error.esborrar.permisos.entorn.permis"));
       	logger.error("No s'han pogut esborrar els permisos a l'entorn. No té permís", nfex);
	} catch (Exception ex) {
       	missatgeError(request, getMessage("error.esborrar.permisos.entorn"), ex.getLocalizedMessage());
       	logger.error("No s'han pogut esborrar els permisos a l'entorn", ex);
       }
       return "redirect:/permisos/entorn.html?id=" + command.getId();
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:21,代码来源:PermisosEntornController.java

示例9: updateAcl

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
 * This implementation will simply delete all ACEs in the database and recreate them on each invocation of
 * this method. A more comprehensive implementation might use dirty state checking, or more likely use ORM
 * capabilities for create, update and delete operations of {@link MutableAcl}.
 */
public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException {
    Assert.notNull(acl.getId(), "Object Identity doesn't provide an identifier");

    // Delete this ACL's ACEs in the acl_entry table
    deleteEntries(retrieveObjectIdentityPrimaryKey(acl.getObjectIdentity()));

    // Create this ACL's ACEs in the acl_entry table
    createEntries(acl);

    // Change the mutable columns in acl_object_identity
    updateObjectIdentity(acl);

    // Clear the cache, including children
    clearCacheIncludingChildren(acl.getObjectIdentity());

    // Retrieve the ACL via superclass (ensures cache registration, proper retrieval etc)
    return (MutableAcl) super.readAclById(acl.getObjectIdentity());
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:24,代码来源:JdbcMutableAclService.java

示例10: updateObjectIdentity

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
 * Updates an existing acl_object_identity row, with new information presented in the passed MutableAcl
 * object. Also will create an acl_sid entry if needed for the Sid that owns the MutableAcl.
 *
 * @param acl to modify (a row must already exist in acl_object_identity)
 *
 * @throws NotFoundException if the ACL could not be found to update.
 */
protected void updateObjectIdentity(MutableAcl acl) {
    Long parentId = null;

    if (acl.getParentAcl() != null) {
        Assert.isInstanceOf(ObjectIdentityImpl.class, acl.getParentAcl().getObjectIdentity(),
            "Implementation only supports ObjectIdentityImpl");

        ObjectIdentityImpl oii = (ObjectIdentityImpl) acl.getParentAcl().getObjectIdentity();
        parentId = retrieveObjectIdentityPrimaryKey(oii);
    }

    Assert.notNull(acl.getOwner(), "Owner is required in this implementation");

    Long ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
    int count = jdbcTemplate.update(updateObjectIdentity,
            parentId, ownerSid, Boolean.valueOf(acl.isEntriesInheriting()), acl.getId());

    if (count != 1) {
        throw new NotFoundException("Unable to locate ACL to update");
    }
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:30,代码来源:JdbcMutableAclService.java

示例11: revocarPermisos

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
private void revocarPermisos(
		Sid sid,
		Class<?> objectClass,
		Serializable objectIdentifier,
		Permission[] permissions) throws NotFoundException {
	ObjectIdentity oid = new ObjectIdentityImpl(objectClass, objectIdentifier);
	try {
		MutableAcl acl = (MutableAcl)aclService.readAclById(oid);
		List<Integer> indexosPerEsborrar = new ArrayList<Integer>();
		int aceIndex = 0;
		for (AccessControlEntry ace: acl.getEntries()) {
			if (ace.getSid().equals(sid)) {
				for (Permission p: permissions) {
					if (p.equals(ace.getPermission()))
						indexosPerEsborrar.add(aceIndex);
				}
			}
			aceIndex++;
		}
		for (Integer index: indexosPerEsborrar)
			acl.deleteAce(index);
		aclService.updateAcl(acl);
	} catch (NotFoundException nfex) {
		// Si no troba l'ACL no fa res
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:27,代码来源:PermisosHelper.java

示例12: removeBooking

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
public Event removeBooking(Event event, User user) throws Exception {
	boolean find = false;
	List<Booking> books = event.getBooking();
	Iterator<Booking> iter = books.iterator();
	while (iter.hasNext()) {
		Booking booking = (Booking) iter.next();
		if(booking.getUser().getUsername().equals(user.getUsername())){
			iter.remove();
			find = true;
			break;
		}
	}

	if(!find) throw new NotFoundException("this account not exists");

	event.setBooking(books);
	return eventRepository.save(event);
}
 
开发者ID:stasbranger,项目名称:RotaryLive,代码行数:19,代码来源:EventServiceImpl.java

示例13: hasPermission

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
@Transactional
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#ae, 'ADMINISTRATION')")
public void clean(AclEntity ae, boolean deleteChildren) {
    Message msg = MsgPicker.getMsg();

    if (ae == null) {
        throw new BadRequestException(msg.getACL_DOMAIN_NOT_FOUND());
    }

    // For those may have null uuid, like DataModel, won't delete Acl.
    if (ae.getId() == null)
        return;

    ObjectIdentity objectIdentity = new ObjectIdentityImpl(ae.getClass(), ae.getId());

    try {
        aclService.deleteAcl(objectIdentity, deleteChildren);
    } catch (NotFoundException e) {
        //do nothing?
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:22,代码来源:AccessService.java

示例14: updateAcl

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
    * This implementation will simply delete all ACEs in the database and recreate them on each invocation of
    * this method. A more comprehensive implementation might use dirty state checking, or more likely use ORM
    * capabilities for create, update and delete operations of {@link MutableAcl}.
    */
@Override
   public MutableAcl updateAcl(MutableAcl acl) throws NotFoundException {
       Assert.notNull(acl.getId(), "Object Identity doesn't provide an identifier");

       // Delete this ACL's ACEs in the acl_entry table
       deleteEntries(retrieveObjectIdentityPrimaryKey(acl.getObjectIdentity()));

       // Create this ACL's ACEs in the acl_entry table
       createEntries(acl);

       // Change the mutable columns in acl_object_identity
       updateObjectIdentity(acl);

       // Clear the cache, including children
       clearCacheIncludingChildren(acl.getObjectIdentity());

       // Retrieve the ACL via superclass (ensures cache registration, proper retrieval etc)
       return (MutableAcl) super.readAclById(acl.getObjectIdentity());
   }
 
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:25,代码来源:MongodbMutableAclService.java

示例15: updateObjectIdentity

import org.springframework.security.acls.model.NotFoundException; //导入依赖的package包/类
/**
 * Updates an existing acl_object_identity row, with new information presented in the passed MutableAcl
 * object. Also will create an acl_sid entry if needed for the Sid that owns the MutableAcl.
 *
 * @param acl to modify (a row must already exist in acl_object_identity)
 *
 * @throws NotFoundException if the ACL could not be found to update.
 */
protected void updateObjectIdentity(MutableAcl acl) {
    String parentId = null;

    if (acl.getParentAcl() != null) {
        Assert.isInstanceOf(ObjectIdentityImpl.class, acl.getParentAcl().getObjectIdentity(),
            "Implementation only supports ObjectIdentityImpl");

        ObjectIdentityImpl oii = (ObjectIdentityImpl) acl.getParentAcl().getObjectIdentity();
        parentId = retrieveObjectIdentityPrimaryKey(oii);
    }

    Assert.notNull(acl.getOwner(), "Owner is required in this implementation");

    String ownerSid = createOrRetrieveSidPrimaryKey(acl.getOwner(), true);
    AclObjectIdentity aoi = objectIdentityRepository.findOne((String)acl.getId());
    if (aoi == null) {
        throw new NotFoundException("Unable to locate ACL to update");
    }
    aoi.setParentObjectId(parentId);
    aoi.setOwnerId(ownerSid);
    aoi.setEntriesInheriting(Boolean.valueOf(acl.isEntriesInheriting()));
    objectIdentityRepository.save(aoi);
}
 
开发者ID:AlexCzar,项目名称:spring-security-acl-mongodb,代码行数:32,代码来源:MongodbMutableAclService.java


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