/** * 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()); } }
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()); } }
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; }
/** * @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); } }
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())); }
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()); } }
/** * 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()); }
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; }
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; }
/** * 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; }
/** * @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); } }
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;
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"; }
@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(); } }
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()); } }
/** * @ejb.create-method * @ejb.permission role-name="${role.auto}" * @ejb.permission role-name="${role.todos}" */ public void ejbCreate() throws CreateException { super.ejbCreate(); try{ InitialContext initialContext = new InitialContext(); roleAuto = (( String ) initialContext.lookup( "java:comp/env/roleAuto" )); roleHelpdesk = (( String ) initialContext.lookup( "java:comp/env/roleHelpdesk" )); }catch(Exception ex){ log.error(ex); } }
public Annotation testAddAnnotation2(Document doc, Users user, LabelSet labelSet) throws CloneNotSupportedException, CreateException { Annotation anno = TestDataProvider.getAnnotation2(); SpanType spanType = anno.getSpanType(); persistAndFlush(spanType); anno.setSpanType(spanType); anno.setUser(user); anno.setDocument(doc); service.process(anno); persistAndFlush(anno); Annotation retAnno = em.find(Annotation.class, anno.getId()); assertNotNull(retAnno); assertTrue(retAnno.isNotSure()); assertTrue(retAnno.getText().equals("the")); assertTrue(retAnno.getDocument().getId().equals(doc.getId())); assertTrue(retAnno.getUser().getId().equals(user.getId())); assertTrue(retAnno.getStart() == 65); assertTrue(retAnno.getEnd() == 68); assertTrue(retAnno.getLabels().isEmpty()); assertTrue(retAnno.getSpanType().getName().equals("passage")); // Add label to annotation 1 Label label = TestDataProvider.getLabel1(); label.setLabelSet(labelSet); persistAndFlush(label); service.addLabelToAnnotation(retAnno.getId(), label); Set<Label> labels = retAnno.getLabels(); Object[] labelArr = labels.toArray(); Label newLabel = (Label) labelArr[0]; assertTrue(labels.size() == 1); assertTrue(newLabel.getName().equals(label.getName())); return anno; }
public Response resetUserPassword(Users entity) throws CreateException { try { Users user = usersDAO.find(entity.getId(), false); String newPwd = Utility.getRandomString(14); String hashedPwd = Utility.hashPassword(newPwd); emailProvider.sendPasswordResetNotification(user, newPwd); user.setPassword(hashedPwd); return usersDAO.merge(user); } catch (NoResultException e) { throw new CreateException(e.getMessage()); } }
public String Create() { // System.out.println ("ScriptJsfBean.Create () name="+name); try { ScriptLocal s = Ejb.lookupScriptBean().create(name); s.setDescription(description); s.setScript(text.getBytes()); } catch (CreateException ex) { Logger.getLogger(ScriptJsfBean.class.getName()).log(Level.SEVERE, null, ex); } return null; }
public void process(Link entity) throws CreateException { try { Users user = (Users) usersDAO.find(entity.getUser().getId(), false); entity.setUser(user); Document doc = (Document) documentDAO.find(entity.getDocument().getId(), false); entity.setDocument(doc); updateDocument(doc, user); // Annotation 1 Annotation anno1 = entity.getAnnotation1(); if (anno1.getId() == null) { // does not exist already process(anno1); } else { anno1 = (Annotation) annotationDAO.find(entity.getAnnotation1().getId(), false); } entity.setAnnotation1(anno1); // Annotation 2 Annotation anno2 = entity.getAnnotation2(); if (anno2.getId() == null) { // does not exist already process(anno2); } else { anno2 = (Annotation) annotationDAO.find(entity.getAnnotation2().getId(), true); } entity.setAnnotation2(anno2); Set<LinkLabel> linkLabels = new HashSet<>(); for (LinkLabel l : entity.getLinkLabels()) { LinkLabel newLabel = (LinkLabel) linkLabelDAO.find(l.getId(), false); linkLabels.add(newLabel); } entity.setLinkLabels(linkLabels); } catch (NoResultException e) { throw new CreateException(e.getMessage()); } }
public String AddFw() { // System.out.println("DeviceProfileBean.AddFw name="+name+" hwid="+hwid+" version="+version); DeviceProfile2SoftwareLocalHome h = Ejb.lookupDeviceProfile2SoftwareBean(); try { h.create(name, hwid, version); } catch (CreateException ex) { setErrorMessage(ex.getMessage()); } return null; }
/** * @ejb.create-method * @ejb.permission role-name="${role.admin}" * @ejb.permission role-name="${role.todos}" * @ejb.permission role-name="${role.gestor}" * @ejb.permission role-name="${role.auto}" */ public void ejbCreate() throws CreateException { super.ejbCreate(); try { InitialContext ctx = new InitialContext(); ROLE_AUTO = (String) ctx.lookup("java:comp/env/roleAuto"); } catch (NamingException e) { throw new CreateException("No se ha especificado role auto"); } }
/** * @ejb.create-method * @ejb.permission role-name="${role.gestor}" * @ejb.permission role-name="${role.auto}" */ public void ejbCreate() throws CreateException { try { javax.naming.InitialContext initialContext = new javax.naming.InitialContext(); roleAuto = ( String ) initialContext.lookup( "java:comp/env/role.auto" ); } catch( Exception exc ) { exc.printStackTrace(); } }
/** * @ejb.create-method * @ejb.permission role-name="${role.todos}" * @ejb.permission role-name="${role.auto}" */ public void ejbCreate() throws CreateException { log.info("ejbCreate: " + this.getClass()); try { javax.naming.InitialContext initialContext = new javax.naming.InitialContext(); ROLE_AUTO = (String) initialContext.lookup( "java:comp/env/roleAuto" ); } catch( Exception exc ) { log.error( exc ); throw new CreateException( exc.getLocalizedMessage() ); } }
public void reimportProject(InputStream is) throws CreateException { try { } catch (NoResultException e) { throw new CreateException(e.getMessage()); } }
public org.openacs.SoftwareDetailPK ejbCreate(Integer hwid, String version, byte[] paramNames, byte[] methods) throws CreateException { setHwid(hwid); setVersion(version); setParamNames(paramNames); setMethods(methods); return null; }
@POST @Consumes({MediaType.APPLICATION_JSON}) public Response create(TimeLogging entity) { try { LoginUtil.check(usersDAO.checkLogin(getSessionID())); 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(); } }
public java.lang.String ejbCreate(String oui, String mappedoui) throws CreateException { if (oui == null) { throw new CreateException("The field \"oui\" must not be null"); } setOui(oui); setMappedoui(mappedoui); return null; }
public String create() { try { save(Ejb.lookupDeviceProfileBean().create(name)); return "created"; } catch (CreateException ex) { setErrorMessage(ex.getMessage()); } return null; }
public org.openacs.ATMErrorsStatsPK ejbCreate(Integer hostid, Timestamp time, int type) throws CreateException { setHostid(hostid); setTime(time); setType(type); return null; }
public static void setFirmwarePath(String firmwarePath) throws CreateException { app.firmwarePath = firmwarePath; app.setProperty(PROPERTY_FIRMWAREPATH, firmwarePath); }
private PantallaFacade getFacade() throws NamingException,CreateException,RemoteException { return PantallaFacadeUtil.getHome().create(); }
public void process(Document entity) throws CreateException { Project project = (Project) projectDAO.find(entity.getProject().getId(), false); entity.setProject(project); process(entity.getDefaultAnnotations()); }
private ExpedienteFacade getFacade() throws NamingException,CreateException,RemoteException { return ExpedienteFacadeUtil.getHome( ).create(); }
private ConfiguracionFacadeLocal getFacade() throws NamingException,RemoteException,CreateException { return ConfiguracionFacadeUtil.getLocalHome().create(); }
private AuditaFacade getFacade() throws NamingException,CreateException,RemoteException { return AuditaFacadeUtil.getHome().create(); }
/** * @ejb.create-method * @ejb.permission unchecked = "true" */ public void ejbCreate() throws CreateException { super.ejbCreate(); }