package net.sourceforge.fenixedu.presentationTier.Action.contactsManagement; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sourceforge.fenixedu.domain.contacts.PartyContact; import net.sourceforge.fenixedu.presentationTier.Action.base.FenixDispatchAction; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import pt.ist.fenixWebFramework.services.Service; import pt.ist.fenixWebFramework.struts.annotations.Forward; import pt.ist.fenixWebFramework.struts.annotations.Forwards; import pt.ist.fenixWebFramework.struts.annotations.Mapping; @Mapping(path = "/contactsVisibility", module = "person") @Forwards({ @Forward(name = "contactsEdit", path = "/person/visualizePersonalInfo.jsp") }) public class ManageSelfContactsVisibility extends FenixDispatchAction { public ActionForward contactVisible(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { return process(mapping, request, true); } public ActionForward contactNotVisible(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { return process(mapping, request, false); } private ActionForward process(ActionMapping mapping, HttpServletRequest request, boolean value) { PartyContact contact = getDomainObject(request, "contactOID"); changeVisibility(contact, value); return mapping.findForward("contactsEdit"); } @Service private void changeVisibility(PartyContact contact, boolean value) { contact.setVisiblePublic(value); } }