本文整理汇总了Java中javax.ejb.CreateException类的典型用法代码示例。如果您正苦于以下问题:Java CreateException类的具体用法?Java CreateException怎么用?Java CreateException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreateException类属于javax.ejb包,在下文中一共展示了CreateException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeScheme
import javax.ejb.CreateException; //导入依赖的package包/类
/**
* Removes a scheme.
*
* @param schemeId
* @throws CreateException is thrown when the scheme references projects
*/
public void removeScheme(Long schemeId) throws CreateException {
try {
Scheme scheme = (Scheme) schemeDAO.find(schemeId, false);
Set<Project> projectList = scheme.getProjects();
if (!projectList.isEmpty()) {
throw new CreateException("Service: The scheme references projects.");
}
schemeDAO.remove(scheme);
} catch (NoResultException e) {
throw new CreateException(e.getMessage());
}
}
示例2: changeSpanType
import javax.ejb.CreateException; //导入依赖的package包/类
public Annotation changeSpanType(Long annoId, SpanType spanType) throws CreateException {
try {
Annotation anno = (Annotation) annotationDAO.find(annoId, false);
updateDocument(anno.getDocument(), anno.getUser());
spanType = (SpanType) spanTypeDAO.find(spanType.getId(), false);
anno.setSpanType(spanType);
// Delete all links connected to the Annotation
List<Link> linkList = linkDAO.getAllLinksByAnnoId(annoId);
for (Link l : linkList) {
linkDAO.remove(l);
}
annotationDAO.merge(anno);
return anno;
} catch (NoResultException e) {
throw new CreateException(e.getMessage());
}
}
示例3: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
public java.lang.String ejbCreate(java.lang.String name, String type,
long min, long max, int length, String description, String version,
String def, boolean writable, String trname) throws CreateException {
if (name == null) {
throw new CreateException("The field \"name\" must not be null");
}
if (type == null) {
throw new CreateException("The field \"name\" must not be null");
}
// TODO add additional validation code, throw CreateException if data is not valid
setName(name);
setType(type);
setMin(min);
setMax(max);
setLength(length);
setDescription(description.getBytes());
setVersion(version);
setDefaultvalue(def);
setWritable(writable);
setTrname(trname);
return null;
}
示例4: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
/**
* @ejb.create-method
* @ejb.permission role-name="${role.todos}"
* @ejb.permission role-name="${role.auto}"
*/
public void ejbCreate() throws CreateException
{
super.ejbCreate();
try{
InitialContext initialContext = new InitialContext();
roleAuto = (( String ) initialContext.lookup( "java:comp/env/roleAuto" ));
roleDelegacion = (( String ) initialContext.lookup( "java:comp/env/roleDelegacion" ));
roleHelpdesk = (( String ) initialContext.lookup( "java:comp/env/roleHelpdesk" ));
roleGestor = (( String ) initialContext.lookup( "java:comp/env/roleGestor" ));
// Obtenemos prefijo para alta automatica
String prefijo = ConfigurationUtil.getInstance().obtenerPropiedades().getProperty("usuario.prefijoAuto");
if (StringUtils.isBlank(prefijo)) {
throw new Exception("No se ha configurado prefijo para el alta automatica de usuario");
}
prefijoAuto = StringUtils.trim(prefijo);
}catch(Exception ex){
log.error(ex);
}
}
示例5: process
import javax.ejb.CreateException; //导入依赖的package包/类
public void process(Users currUser, Users newUser) throws CreateException {
// Check user roles
List<Users.RoleType> allowedRoles = userPermissionMap.get(currUser.getRole());
if (!allowedRoles.contains(newUser.getRole())) {
throw new CreateException("Service: The requested user role is not allowed.");
}
Set<Project> proSet = new HashSet<>();
for (Project p : newUser.getProjects()) {
Project proj = (Project) projectDAO.find(p.getId(), false);
proSet.add(proj);
}
newUser.setProjects(proSet);
newUser.setCreateDate(Utility.getCurrentTime());
newUser.setPassword(
Utility.hashPassword(
newUser.getPassword()));
}
示例6: removeUserFromProject
import javax.ejb.CreateException; //导入依赖的package包/类
public void removeUserFromProject(Long projId, Long userId) throws CreateException {
try {
Project proj = (Project) projectDAO.find(projId, false);
Users user = (Users) usersDAO.find(userId, false);
proj.removeUsers(user);
user.removeProject(proj);
removeStatesFromProject(proj, user);
projectDAO.merge(proj);
usersDAO.merge(user);
} catch (NoResultException e) {
throw new CreateException(e.getMessage());
}
}
示例7: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
/**
* Prepara una nueva instancia con los datos guardados.
* @ejb.create-method
*/
public void ejbCreate(InstanciaBean bean) throws CreateException {
ejbCreate(bean.getModelo(), bean.getLocale(), bean.getPerfil(), bean.getVersion());
for (int i = 0; i < bean.getDataMaps().size(); i++) {
Map map = (Map) bean.getDataMaps().get(i);
if (map == null) {
throw new CreateException("Encontrado DataMap nulo en InstanciaBean");
}
introducirDatosPantalla(map);
avanzarPantalla();
}
// Dejar la ultima pantalla en la que se habia estado.
retrocederPantalla();
// Afegir anexos.
anexos.putAll(bean.getAnexos());
}
示例8: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
public HostPropertyPK ejbCreate(Integer parentId, String name, String value) throws CreateException {
if (parentId == null) {
throw new CreateException("The field \"parentId\" must not be null");
}
if (name == null) {
throw new CreateException("The field \"name\" must not be null");
}
setParentId(parentId);
setName(name);
setValue(value);
return null;
}
示例9: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
public org.openacs.DSLStatsPK ejbCreate(Integer hostid, Timestamp time) throws CreateException {
if (hostid == null) {
throw new CreateException("The field \"hostid\" must not be null");
}
if (time == null) {
throw new CreateException("The field \"time\" must not be null");
}
setHostid(hostid);
setTime(time);
return null;
}
示例10: removeLabelFromAnnotation
import javax.ejb.CreateException; //导入依赖的package包/类
/**
* Removes a label from an annotation.
* The Label must exist in the annotation otherwise an
* IllegalArgumentException will be thrown.
*
* @param anno
* @param label
*/
public void removeLabelFromAnnotation(Annotation anno, Label label) throws CreateException {
Set<Label> labels = anno.getLabels();
if (!labels.contains(label)) {
throw new CreateException("Service: Label does not exist in Annotation.");
}
anno.removeLabel(label);
annotationDAO.merge(anno);
return;
}
示例11: ejbCreate
import javax.ejb.CreateException; //导入依赖的package包/类
/**
* @ejb.create-method
* @ejb.permission role-name="${role.todos}"
* @ejb.permission role-name="${role.auto}"
*/
public void ejbCreate() throws CreateException {
super.ejbCreate();
try{
InitialContext initialContext = new InitialContext();
roleHelpDesk = (( String ) initialContext.lookup( "java:comp/env/roleHelpDesk" ));
roleRegistro = (( String ) initialContext.lookup( "java:comp/env/roleRegistro" ));
roleGestor = (( String ) initialContext.lookup( "java:comp/env/roleGestor" ));
}catch(Exception ex){
log.error(ex);
}
}
示例12: create
import javax.ejb.CreateException; //导入依赖的package包/类
org.openacs.ATMErrorsStatsLocal create(Integer hostid, Timestamp time, int type,
Timestamp intervalStart,
Long ATUCCRCErrors, Long ATUCFECErrors, Long ATUCHECErrors, Long CellDelin,
Long CRCErrors, Long FECErrors, Long HECErrors, Long ErroredSecs,
Long InitErrors, Long InitTimeouts, Long LinkRetrain, Long LossOfFraming,
Long ReceiveBlocks, Long SeverelyErroredSecs, Long TransmitBlocks,
Long LossOfPower, Long LossOfSignal) throws CreateException;
示例13: Create
import javax.ejb.CreateException; //导入依赖的package包/类
public String Create() {
System.out.println("Software.Create: hwid=" + hwid + " version=" + version + " filename=" + filename);
try {
SoftwareLocal s = Ejb.lookupSoftwareBean().create(hwid, version, null, null);
File f = new File(getFwPath() + filename);
s.setFilename(filename);
s.setSize(f.length());
} catch (CreateException ex) {
setErrorMessage(ex.getMessage());
return null;
}
return "swcreated";
}
示例14: create
import javax.ejb.CreateException; //导入依赖的package包/类
@POST
@Consumes({MediaType.APPLICATION_JSON})
public Response create(Link entity) {
try {
LoginUtil.check(usersDAO.checkLogin(getSessionID(), Users.RoleType.annotator));
service.process(entity);
return usersDAO.create(entity);
} catch (SecurityException e) {
return Response.status(Response.Status.FORBIDDEN).build();
} catch (CreateException ex) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
}
示例15: removeProjectManagerFromProject
import javax.ejb.CreateException; //导入依赖的package包/类
public void removeProjectManagerFromProject(Long projId, Long userId) throws CreateException {
try {
Project proj = (Project) projectDAO.find(projId, false);
Users user = (Users) usersDAO.find(userId, false);
proj.removeProjectManager(user);
user.removeManagingProjects(proj);
projectDAO.merge(proj);
usersDAO.merge(user);
} catch (NoResultException e) {
throw new CreateException(e.getMessage());
}
}