private void update() { User user = null; try { user = getUser(); setEnabled(object != null && (isAdmin() || user.equals(object))); } catch (RaplaException ex) { setEnabled(false); return; } }
public List<Row> getAttributes( Allocatable allocatable, LinkController controller, boolean excludeAdditionalInfos) { ArrayList<Row> att = new ArrayList<Row>(); att.addAll(super.getClassificationAttributes(allocatable, excludeAdditionalInfos, controller)); final Locale locale = getLocale(); User owner = allocatable.getOwner(); User lastChangeBy = allocatable.getLastChangedBy(); if (owner != null) { final String ownerName = owner.getName(locale); String ownerText = encode(ownerName); if (controller != null) ownerText = controller.createLink(owner, ownerName); att.add(new Row(getString("resource.owner"), ownerText)); } if (lastChangeBy != null && (owner == null || !lastChangeBy.equals(owner))) { final String lastChangedName = lastChangeBy.getName(locale); String lastChangeByText = encode(lastChangedName); if (controller != null) lastChangeByText = controller.createLink(lastChangeBy, lastChangedName); att.add(new Row(getString("last_changed_by"), lastChangeByText)); } return att; }
public List<Row> getAttributes( Reservation reservation, LinkController controller, User user, boolean excludeAdditionalInfos) { ArrayList<Row> att = new ArrayList<Row>(); att.addAll(getClassificationAttributes(reservation, excludeAdditionalInfos, controller)); User owner = reservation.getOwner(); final Locale locale = getLocale(); if (owner != null) { final String ownerName = owner.getName(locale); String ownerText = encode(ownerName); if (controller != null) ownerText = controller.createLink(owner, ownerName); att.add(new Row(getString("reservation.owner"), ownerText)); } User lastChangeBy = reservation.getLastChangedBy(); if (lastChangeBy != null && (owner == null || !lastChangeBy.equals(owner))) { final String lastChangedName = lastChangeBy.getName(locale); String lastChangeByText = encode(lastChangedName); if (controller != null) lastChangeByText = controller.createLink(lastChangeBy, lastChangedName); att.add(new Row(getString("last_changed_by"), lastChangeByText)); } Allocatable[] resources = reservation.getResources(); String resourceList = allocatableList(reservation, resources, user, controller); if (resourceList.length() > 0) { att.add(new Row(getString("resources"), resourceList)); } Allocatable[] persons = reservation.getPersons(); String personList = allocatableList(reservation, persons, user, controller); if (personList.length() > 0) { att.add(new Row(getString("persons"), personList)); } return att; }