コード例 #1
0
 public Contact getContact(String id) {
   Contact cn = em.find(Contact.class, id);
   if (!cn.equals(null)) {
     return cn;
   }
   return new Contact();
 }
コード例 #2
0
  /** @return */
  private String[][] getContactColumns(final int[] columnWidth) {

    String[][] columns;
    if (customer != null) {
      Contact contact;
      final String[] filter = getContactFilter();
      final Collection<Business> list = ContactController.getContacts(filter);
      columns = new String[list.size()][];
      final Iterator<Business> it = list.iterator();
      int i = 0;
      while (it.hasNext()) {
        contact = (Contact) it.next();
        columns[i] =
            new String[] {
              contact.getIdContact(),
              contact.getConPref(),
              contact.getConLName(),
              contact.getConFName(),
              contact.getConMobile(),
              contact.getConEMail(),
              contact.getConPhone()
            };
        calculateColumnWidth(columns[i], columnWidth);
        i++;
      }
    } else {
      columns = null;
    }
    return columns;
  }
コード例 #3
0
 public void toggleBlowUp() {
   Rectangle r = this.getBounds();
   if (blowUp) {
     text.setText(contact.toString());
     r.grow(0, GROW);
     this.setBounds(r);
     this.revalidate();
     // this.repaint();
     blowUp = false;
   } else {
     text.setText(contact.getAHRA() + "");
     r.grow(0, -GROW);
     this.setBounds(r);
     this.revalidate();
     // this.repaint();
     blowUp = true;
   }
 }
コード例 #4
0
  @Transactional(readOnly = false)
  @RequestMapping(
      value = "/edit",
      method = {RequestMethod.POST, RequestMethod.GET})
  public void editor(
      @RequestParam String oper,
      @RequestParam(required = false) Long id,
      Contact contacts,
      BindingResult result,
      HttpServletResponse response)
      throws IOException {
    if (result.hasErrors()) {
      response.sendError(400, result.toString());
      return;
    }
    switch (oper) {
      case "add":
        contactRepository.save(contacts);
        response.setStatus(200);
        break;
      case "edit":
        Contact fromDB = contactRepository.getOne(contacts.getContactId());
        if (fromDB != null) {
          if (contacts.getVersion() >= fromDB.getVersion()) {
            contactRepository.save(contacts);
            response.setStatus(200);
          } else {
            response.sendError(406, "ANOTHER TRANSACTION MODIFICATION");
          }
        } else {
          response.sendError(406, "NO CONTACT TYPE FOUND");
        }

        break;
      case "del":
        if (id != null) {
          contactRepository.delete(id);
          response.setStatus(200);
        }
        break;
      default:
        response.sendError(406, "UNKNOWN OPERATION");
    }
  }
コード例 #5
0
  public ContactWidget(Contact c, ImageIcon img) {
    /* Link contact. */
    contact = c;
    /* Set variables. */
    String name = c.getAHRA() + "";
    Dimension dim = new Dimension(Integer.MAX_VALUE, HEIGHT);

    /* Set our data. */
    text = new JLabel(name);
    icon = new JLabel();
    icon.setIcon(img);
    blowUp = true;
    /* Set panel properties. */
    this.setName(name);
    this.setMaximumSize(dim);
    this.setLayout(new BorderLayout());
    this.add(icon, BorderLayout.WEST);
    this.add(text, BorderLayout.CENTER);
  }
コード例 #6
0
  public ContactWidget(Contact c) {
    /* Link contact object. */
    contact = c;
    /* Set variables. */
    String name = c.getAHRA() + "";
    ImageIcon img = new ImageIcon("res/images/AllnetLogo_x50.png");
    Dimension dim = new Dimension(Integer.MAX_VALUE, HEIGHT);

    /* Set our data. */
    text = new JLabel(name);
    icon = new JLabel();
    icon.setIcon(img);
    blowUp = true;
    /* Set panel properties. */
    this.setName(name);
    this.setSize(dim);
    this.setBackground(bg);
    this.setLayout(new BorderLayout());
    this.add(icon, BorderLayout.WEST);
    this.add(text, BorderLayout.CENTER);
  }
コード例 #7
0
 /**
  * Get the UUID of the contact this widget represents.
  *
  * @return UUID of contact.
  */
 public UUID getUUID() {
   return contact.getUUID();
 }