List of usage examples for java.lang Long parseLong
public static long parseLong(String s) throws NumberFormatException
From source file:com.mycompany.CRMFly.Converters.ContractConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return contractBean.getContractForId(id); }
From source file:com.mycompany.CRMFly.Converters.CustomerConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return customerBean.getCustomerForId(id); }
From source file:com.mycompany.CRMFly.Converters.DocumentConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return documentBean.getDocumentForId(id); }
From source file:com.mycompany.CRMFly.Converters.EmployeeConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return employeeBean.getEmployeeForId(id); }
From source file:com.mycompany.CRMFly.Converters.ShipmentConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return shipmentBean.getShipmentForId(id); }
From source file:com.j2.cs.webservices.metrofax.server.json.JsonLongTypeAdapter.java
@Override public Number read(JsonReader in) throws IOException { if (in.peek() == JsonToken.NULL) { in.nextNull();/*from w ww . j av a 2 s . co m*/ return null; } try { String result = in.nextString(); if (StringUtils.isBlank(result)) { return null; } return Long.parseLong(result); } catch (NumberFormatException e) { return null; } }
From source file:controllers.QuestionEdit.java
/** * Tlcharge les images dans les rponses/*from w w w .j av a 2 s .c o m*/ * @return */ public static Result uploadForReponses() { MultipartFormData body = request().body().asMultipartFormData(); DynamicForm info = Form.form().bindFromRequest(); FilePart fp = body.getFile("reponseImages"); int reponsePosition = Integer.parseInt(info.get("position")); Long questionId = Long.parseLong(info.get("question")); if (UploadImages.isImage(fp)) { Image i = new Image(fp.getFilename()); File image = fp.getFile(); File destinationFile = new File( play.Play.application().path().getAbsolutePath() + "/img/" + i.fileName); try { FileUtils.copyFile(image, destinationFile); i.save(); Question question = Question.find.byId(questionId); question.reponses.get(reponsePosition).image = i; question.save(); return ok("<img class=\"image\" src=\"/images/" + i.fileName + "\">"); } catch (IOException e) { e.printStackTrace(); System.out.println("Impossible de copier l'image sur le serveur..."); return internalServerError("Impossible de copier l'image sur le serveur..."); } } else return badRequest("Le fichier que vous avez slectionn n'est pas reconnu comme une image."); }
From source file:controllers.TNodes.java
public static void show(String id) throws Exception { ObjectType type = ObjectType.get(getControllerClass()); notFoundIfNull(type);//from w w w . j a va 2 s . c o m Model object = type.findById(id); notFoundIfNull(object); List<TUser> tUsers = TUser.findAll(); List<DataDictionary> T_NODE_DEPARTMENTS = DataDictionary.find("T_DD_PARENTID", Long.parseLong("1")).fetch(); List<DataDictionary> T_NODE_VENDORS = DataDictionary.find("T_DD_PARENTID", Long.parseLong("2")).fetch(); List<DataDictionary> T_NODE_OSS = DataDictionary.find("T_DD_PARENTID", Long.parseLong("3")).fetch(); List<DataDictionary> T_NODE_SYSTEMS = DataDictionary.find("T_DD_PARENTID", Long.parseLong("4")).fetch(); try { render(type, object, tUsers, T_NODE_DEPARTMENTS, T_NODE_VENDORS, T_NODE_OSS, T_NODE_SYSTEMS); } catch (TemplateNotFoundException e) { render("CRUD/show.html", type, object); } }
From source file:com.mycompany.CRMFly.Converters.OrganisationConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return organisationBean.getOrganisationForId(id); }
From source file:com.mycompany.CRMFly.Converters.ParticipantInProjectConverter.java
@Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return projectBean.getParticipantForId(id); }