- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 7/31/2012 #724 bphillip Initial creation - * 3/13/2013 1082 bphillip Made transactional - * 4/19/2013 1931 bphillip Refactored to use web application spring container and cxf services - * - *- * - * @author bphillip - * @version 1.0 - */ -@Path("/AddRegistryParty") -@Service -@Transactional -public class AddRegistryParty { - - /** Serial */ - private static final long serialVersionUID = 1422748054768442033L; - - /** The logger */ - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(AddRegistryParty.class); - - /** The page to display upon success */ - private static final String SUCCESS_RESPONSE_PAGE = "addPartySuccess"; - - /** the page to display upon failure */ - private static final String ERROR_RESPONSE_PAGE = "addPartyFailure"; - - private PartyDao partyDao; - - private LifecycleManagerImpl lcm; - - private RegistryWebUtil webUtil; - - @POST - @Produces("text/html") - public Response doPost(@Context HttpServletRequest request) - throws IOException { - String partyId = request.getParameter(WebFields.ID.fieldName()); - String objectType = request - .getParameter(WebFields.OBJ_TYPE.fieldName()); - PartyType existingParty = null; - - // The EDEX internal user cannot be modified - if (partyId.equals(RegistryUtil.DEFAULT_OWNER)) { - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Cannot modify EDEX Internal User"); - } - - /* - * Check to see if the party already exists. If so, the user cannot be - * added - */ - existingParty = partyDao.getById(partyId); - - if (existingParty != null) { - statusHandler.error("Error adding " + objectType + " to registry. " - + objectType + " " + partyId + " already exists"); - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, objectType - // + " Already Exists"); - - } - - /* - * Create a new submit request containing the new party - */ - SubmitObjectsRequest submitRequest = null; - try { - submitRequest = webUtil.createParty(request); - } catch (EbxmlRegistryException e) { - statusHandler.error("Error creating " + objectType, e); - return Response.serverError().build(); - // webUtil.sendErrorResponse( - // request, - // response, - // ERROR_RESPONSE_PAGE, - // partyId, - // objectType, - // "Error creating " + objectType + "\n" - // + e.getLocalizedMessage()); - } - - // Submit the objects to the registry - try { - lcm.submitObjects(submitRequest); - webUtil.updatePC(request); - } catch (Exception e) { - statusHandler.error("Error submitting new " + objectType - + " to the registry", e); - return Response.serverError().build(); - // webUtil.sendErrorResponse( - // request, - // response, - // ERROR_RESPONSE_PAGE, - // partyId, - // objectType, - // "Error submitting new " + objectType - // + " to the registry\n" - // + e.getLocalizedMessage()); - } - - // Send success response back to the caller - return Response.ok().build(); - // webUtil.sendSuccessResponse(request, response, SUCCESS_RESPONSE_PAGE, - // partyId, objectType); - } - - public void setWebUtil(RegistryWebUtil webUtil) { - this.webUtil = webUtil; - } - - public void setPartyDao(PartyDao partyDao) { - this.partyDao = partyDao; - } - - public void setLcm(LifecycleManagerImpl lcm) { - this.lcm = lcm; - } -} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/DeleteRegistryParty.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/DeleteRegistryParty.java deleted file mode 100644 index c110abcf5c..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/DeleteRegistryParty.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.registry.ebxml.web; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; - -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PartyType; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.raytheon.uf.common.registry.ebxml.RegistryUtil; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.registry.ebxml.dao.PartyDao; - -/** - * - * Servlet implementation used to delete a user or organization from the - * registry. FIXME: This class will be refactored in a later ticket - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 7/31/2012 #724 bphillip Initial creation - * 3/13/2013 1082 bphillip Made transactional - * 4/19/2013 1931 bphillip Refactored to use web application spring container and cxf services - * - *- * - * @author bphillip - * @version 1.0 - */ -@Path("/DeleteRegistryParty") -@Service -@Transactional -public class DeleteRegistryParty { - - /** The serial ID */ - private static final long serialVersionUID = -9009661529309992652L; - - /** The page to display upon success */ - private static final String SUCCESS_RESPONSE_PAGE = "deletePartySuccess"; - - /** The page to display upon failure */ - private static final String ERROR_RESPONSE_PAGE = "deletePartyFailure"; - - private PartyDao partyDao; - - private RegistryWebUtil webUtil; - - /** The logger */ - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(DeleteRegistryParty.class); - - @POST - @Produces("text/html") - public Response doPost(@Context HttpServletRequest request) - throws IOException { - String partyId = request.getParameter(WebFields.ID.fieldName()); - String objectType = request - .getParameter(WebFields.OBJ_TYPE.fieldName()); - PartyType existingParty = null; - - // The EDEX internal user cannot be modified - if (partyId.equals(RegistryUtil.DEFAULT_OWNER)) { - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Cannot remove EDEX Internal User"); - } - - /* - * Check if the party exists. If not, the party obviously cannot be - * deleted - */ - - existingParty = partyDao.getById(partyId); - - if (existingParty == null) { - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Unable to delete " + objectType + " " + partyId + ". " - // + objectType + " does not exist"); - } - - /* - * Remove any associations to the party - */ - try { - webUtil.removeAssociations(existingParty); - webUtil.removeParty(existingParty); - } catch (Exception e) { - statusHandler.error("Error modifying user", e); - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Error removing associations to " + objectType + "\n" - // + e.getLocalizedMessage()); - } - - // Send back a successful response to the requester - // webUtil.sendSuccessResponse(request, response, - // SUCCESS_RESPONSE_PAGE, partyId, objectType); - return Response.ok().build(); - } - - public void setPartyDao(PartyDao partyDao) { - this.partyDao = partyDao; - } - - public void setWebUtil(RegistryWebUtil webUtil) { - this.webUtil = webUtil; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/ModifyRegistryParty.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/ModifyRegistryParty.java deleted file mode 100644 index 6907140832..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/ModifyRegistryParty.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.registry.ebxml.web; - -import java.io.IOException; - -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; - -import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PartyType; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.raytheon.uf.common.registry.ebxml.RegistryUtil; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.edex.registry.ebxml.dao.PartyDao; -import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; -import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl; - -/** - * - * Servlet implementation used to modify a user or organization in the registry - * FIXME: This class will be refactored in a later ticket - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 7/31/2012 #724 bphillip Initial creation - * 3/13/2013 1082 bphillip Made transactional - * 4/19/2013 1931 bphillip Refactored to use web application spring container and cxf services - * - *- * - * @author bphillip - * @version 1.0 - */ -@Path("/DeleteRegistryParty") -@Service -@Transactional -public class ModifyRegistryParty { - - /** The serial ID */ - private static final long serialVersionUID = -2361555059266130462L; - - /** Page to display upon success */ - private static final String SUCCESS_RESPONSE_PAGE = "modifyPartySuccess"; - - /** Page to display upon failure */ - private static final String ERROR_RESPONSE_PAGE = "modifyPartyFailure"; - - private PartyDao partyDao; - - private LifecycleManagerImpl lcm; - - private RegistryWebUtil webUtil; - - /** The logger */ - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(ModifyRegistryParty.class); - - @POST - @Produces("text/html") - public Response doPost(@Context HttpServletRequest request) - throws IOException { - - String partyId = request.getParameter(WebFields.ID.fieldName()); - String objectType = request - .getParameter(WebFields.OBJ_TYPE.fieldName()); - PartyType existingParty = null; - - // The EDEX internal user cannot be modified - if (partyId.equals(RegistryUtil.DEFAULT_OWNER)) { - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Cannot modify EDEX Internal User"); - } - - /* - * Check if the party already exists. If the party does not exist, the - * party cannot be modified. An error response is sent to the requester - */ - existingParty = partyDao.getById(partyId); - - if (existingParty == null) { - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Unable to modify " + objectType + " " + partyId + ". " - // + objectType + " does not exist"); - } - - /* - * Create the submit request - */ - SubmitObjectsRequest submitRequest = null; - try { - submitRequest = webUtil.createParty(request); - } catch (EbxmlRegistryException e) { - statusHandler.error("Error modifying user", e); - return Response.serverError().build(); - // webUtil.sendErrorResponse( - // request, - // response, - // ERROR_RESPONSE_PAGE, - // partyId, - // objectType, - // "Error modifying " + objectType + "\n" - // + e.getLocalizedMessage()); - } - - /* - * Remove any associations originating from the modified party - */ - try { - webUtil.removeAssociationsFrom(existingParty); - lcm.submitObjects(submitRequest); - webUtil.updatePC(request); - } catch (Exception e) { - statusHandler.error("Error modifying user", e); - return Response.serverError().build(); - // webUtil.sendErrorResponse(request, response, - // ERROR_RESPONSE_PAGE, partyId, objectType, - // "Error removing associations to " + objectType + "\n" - // + e.getLocalizedMessage()); - } - /* - * Send back success message to the requester - */ - // webUtil.sendSuccessResponse(request, response, SUCCESS_RESPONSE_PAGE, - // partyId, objectType); - return Response.ok().build(); - } - - public void setPartyDao(PartyDao partyDao) { - this.partyDao = partyDao; - } - - public void setWebUtil(RegistryWebUtil webUtil) { - this.webUtil = webUtil; - } - - public void setLcm(LifecycleManagerImpl lcm) { - this.lcm = lcm; - } - -} diff --git a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/RegistryWebAdmin.java b/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/RegistryWebAdmin.java deleted file mode 100644 index e64ec6f18b..0000000000 --- a/edexOsgi/com.raytheon.uf.edex.registry.ebxml/src/com/raytheon/uf/edex/registry/ebxml/web/RegistryWebAdmin.java +++ /dev/null @@ -1,457 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.edex.registry.ebxml.web; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.EmailAddressType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PartyType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PostalAddressType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RoleType; -import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TelephoneNumberType; - -import org.springframework.transaction.annotation.Transactional; - -import com.raytheon.uf.common.registry.ebxml.RegistryUtil; -import com.raytheon.uf.edex.registry.ebxml.dao.ClassificationNodeDao; -import com.raytheon.uf.edex.registry.ebxml.dao.OrganizationDao; -import com.raytheon.uf.edex.registry.ebxml.dao.PartyDao; -import com.raytheon.uf.edex.registry.ebxml.dao.PersonDao; -import com.raytheon.uf.edex.registry.ebxml.dao.RoleDao; -import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException; - -/** - * Class used to get registry information for displaying information on the Data - * Delivery Registry Admin Web Page - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 7/30/2012 724 bphillip Initial creation - * 3/13/2013 1082 bphillip Made transaction and modified to use spring injection - * - *- * - * @author bphillip - * @version 1.0 - */ -@Transactional -public class RegistryWebAdmin { - - /** Static list of role types */ - private static final String[] ROLE_TYPES = new String[] { - "RegistryAdministrator", "RegistryLocalAdministrator", - "RegistryUser", "RegistryGuest" }; - - private PartyDao partyDao; - - private ClassificationNodeDao classificationNodeDao; - - private OrganizationDao organizationDao; - - private PersonDao personDao; - - private RoleDao roleDao; - - /** - * Gets the array of address types from the registry - * - * @return The array of address types from the registry - * @throws EbxmlRegistryException - * If errors occur during database access - */ - public String[] getAddressTypes() throws EbxmlRegistryException { - List
ID | "); - retVal.append("Name | "); - retVal.append("Local Admin | "); - retVal.append("Users | "); - retVal.append("
---|---|---|---|
") - .append("" + orgId - + "").append(" | "); - retVal.append("") - .append(org.getName().getLocalizedString().get(0) - .getValue()).append(" | "); - retVal.append("").append(pcString).append(" | "); - - List"); - for (int i = 0; i < users.size(); i++) { - - retVal.append("" - + users.get(i).getPersonName().getFirstName() + " " - + users.get(i).getPersonName().getLastName() + ""); - if (i != users.size() - 1) { - retVal.append(", "); - } - } - - retVal.append(" | ").append("
ID | "); - retVal.append("Name | "); - retVal.append("Organization | "); - retVal.append("Role | "); - retVal.append("||
---|---|---|---|---|---|
") - .append("" - + userId + "").append(" | "); - retVal.append("") - .append(user.getPersonName().getFirstName() + " " - + user.getPersonName().getLastName()) - .append(" | "); - if (userOrg == null) { - retVal.append(""); - } else { - retVal.append(" | ") - .append("" + userOrg.getId() - + "").append(" | "); - } - if (userRole == null) { - retVal.append(""); - } else { - retVal.append(" | ").append(userRole.getId()).append(" | "); - } - retVal.append("