Issue #1802 Implemented ebxml registry replication
Change-Id: I9ddcb2f3a8410e5bae8f03b4c881625ecef8a531 Former-commit-id:eea115603e
[formerlyfa6cdf46db
] [formerlye3f3483b51
] [formerlye3f3483b51
[formerly120906de78
]] [formerlyeea115603e
[formerlyfa6cdf46db
] [formerlye3f3483b51
] [formerlye3f3483b51
[formerly120906de78
]] [formerlyec69cdeb44
[formerlye3f3483b51
[formerly120906de78
] [formerlyec69cdeb44
[formerly 078545ff0fdbd591ebf69f22eb2e8400386c2bdf]]]]] Former-commit-id:ec69cdeb44
Former-commit-id:734c8388e4
[formerly0a930ce83c
] [formerlye5fbf006dd
] [formerly 7180d9b3117adac4c9059e308a94aef4d11ece28 [formerly 8dba2ff501e80c05042800d7e6c73e3267e77ee2] [formerlye5fbf006dd
[formerlyc0099a8a39
]]] Former-commit-id: 03fbbf1a7089f3c86eabe86ed20a17cb822b9dbd [formerly 95c16add15912c7c114c1119ff48e3bd9099e7ee] [formerly1967c632e5
[formerlyd9b5511b8b
]] Former-commit-id:1967c632e5
Former-commit-id:3733212782
This commit is contained in:
parent
36cae1d9c9
commit
4028c6efd2
132 changed files with 2945 additions and 2548 deletions
|
@ -24,6 +24,7 @@ Bundle-ClassPath: cxf-2.5.0.jar,
|
|||
Export-Package: javax.servlet,
|
||||
javax.servlet.http,
|
||||
javax.ws.rs,
|
||||
org.apache.cxf.annotations,
|
||||
org.apache.cxf.binding.soap,
|
||||
org.apache.cxf.binding.soap.blueprint,
|
||||
org.apache.cxf.binding.soap.interceptor,
|
||||
|
|
|
@ -207,7 +207,8 @@ ALTER TABLE ebxml.classificationscheme OWNER TO awips;
|
|||
|
||||
CREATE TABLE deliveryinfo (
|
||||
key integer NOT NULL,
|
||||
notificationoption character varying(255)
|
||||
notificationoption character varying(255),
|
||||
notifyto text
|
||||
);
|
||||
|
||||
|
||||
|
@ -857,13 +858,34 @@ ALTER TABLE ebxml.postaladdress_slot OWNER TO awips;
|
|||
-- Name: query; Type: TABLE; Schema: ebxml; Owner: awips; Tablespace:
|
||||
--
|
||||
|
||||
--
|
||||
-- TOC entry 390 (class 1259 OID 257160)
|
||||
-- Name: query; Type: TABLE; Schema: ebxml; Owner: awips; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE query (
|
||||
querydefinition character varying(255) NOT NULL
|
||||
key integer NOT NULL,
|
||||
querydefinition character varying(255)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE ebxml.query OWNER TO awips;
|
||||
|
||||
--
|
||||
-- TOC entry 436 (class 1259 OID 258050)
|
||||
-- Name: query_sequence; Type: SEQUENCE; Schema: ebxml; Owner: awips
|
||||
--
|
||||
|
||||
CREATE SEQUENCE query_sequence
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE ebxml.query_sequence OWNER TO awips;
|
||||
|
||||
--
|
||||
-- TOC entry 394 (class 1259 OID 103667)
|
||||
-- Name: query_slot; Type: TABLE; Schema: ebxml; Owner: awips; Tablespace:
|
||||
|
@ -1727,6 +1749,15 @@ ALTER TABLE ONLY notification
|
|||
ADD CONSTRAINT notification_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 4680 (class 2606 OID 257056)
|
||||
-- Name: notificationinfo_pkey; Type: CONSTRAINT; Schema: ebxml; Owner: awips; Tablespace:
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY notificationinfo
|
||||
ADD CONSTRAINT notificationinfo_pkey PRIMARY KEY (key);
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 4670 (class 2606 OID 103548)
|
||||
-- Name: objectref_pkey; Type: CONSTRAINT; Schema: ebxml; Owner: awips; Tablespace:
|
||||
|
@ -1832,7 +1863,7 @@ ALTER TABLE ONLY postaladdress_slot
|
|||
--
|
||||
|
||||
ALTER TABLE ONLY query
|
||||
ADD CONSTRAINT query_pkey PRIMARY KEY (querydefinition);
|
||||
ADD CONSTRAINT query_pkey PRIMARY KEY (key);
|
||||
|
||||
|
||||
--
|
||||
|
@ -1841,7 +1872,7 @@ ALTER TABLE ONLY query
|
|||
--
|
||||
|
||||
ALTER TABLE ONLY query_slot
|
||||
ADD CONSTRAINT query_slot_pkey PRIMARY KEY (query_querydefinition, child_slot_key);
|
||||
ADD CONSTRAINT query_slot_pkey PRIMARY KEY (query_key, child_slot_key);
|
||||
|
||||
|
||||
--
|
||||
|
|
|
@ -29,6 +29,7 @@ export DATADELIVERY_PORT=9588
|
|||
export EBXML_REGISTRY_HOST=${DATADELIVERY_HOST}
|
||||
export EBXML_REGISTRY_PORT=${DATADELIVERY_PORT}
|
||||
export EBXML_REGISTRY_SOAP_PORT=10144
|
||||
export EBXML_REGISTRY_REPLICATION=1
|
||||
|
||||
# moved here from environment.xml
|
||||
# these values are returned to clients that contact the localization service
|
||||
|
@ -38,8 +39,8 @@ export JMS_SERVER=tcp://localhost:5672
|
|||
export RADAR_SERVER=tcp://localhost:8813
|
||||
export DATADELIVERY_SERVER=http://${DATADELIVERY_HOST}:${DATADELIVERY_PORT}/services
|
||||
export EBXML_REGISTRY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_PORT}/services
|
||||
export EBXML_REGISTRY_LCM_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_SOAP_PORT}/lcm?WSDL
|
||||
export EBXML_REGISTRY_QUERY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_SOAP_PORT}/query?WSDL
|
||||
export EBXML_REGISTRY_LCM_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_SOAP_PORT}/lifecycleManager?WSDL
|
||||
export EBXML_REGISTRY_QUERY_SERVICE=http://${EBXML_REGISTRY_HOST}:${EBXML_REGISTRY_SOAP_PORT}/queryManager?WSDL
|
||||
export NCF_BANDWIDTH_MANAGER_SERVICE=http://${DATADELIVERY_HOST}:9590/services
|
||||
|
||||
# set the AWIPS II shared directory
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
|
@ -48,11 +48,10 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(objectType = InitialPendingSharedSubscription.class,
|
||||
value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
|
||||
@RegistryObject(objectType = InitialPendingSharedSubscription.class, value = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = SharedSubscription.class) })
|
||||
public class PendingSharedSubscription extends InitialPendingSharedSubscription
|
||||
|
|
|
@ -35,5 +35,7 @@ package com.raytheon.uf.common.datadelivery.registry;
|
|||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface PendingSubscription extends InitialPendingSubscription {
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.raytheon.uf.common.registry.annotations.AssociationMapping;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
|
||||
|
@ -53,11 +53,10 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
@RegistryObject(objectType = InitialPendingUserSubscription.class,
|
||||
value = { Subscription.PROVIDER_NAME_SLOT,
|
||||
Subscription.NAME_SLOT, Subscription.DATA_SET_SLOT,
|
||||
Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = RegistryUtil.ASSOCIATION_RELATED_TO, keyFields = {
|
||||
@RegistryObject(objectType = InitialPendingUserSubscription.class, value = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT,
|
||||
InitialPendingSubscription.CHANGE_REQUEST_ID_SLOT }, associationMappings = { @AssociationMapping(associationType = AssociationTypes.RELATED_TO, keyFields = {
|
||||
Subscription.PROVIDER_NAME_SLOT, Subscription.NAME_SLOT,
|
||||
Subscription.DATA_SET_SLOT, Subscription.OWNER_SLOT }, required = false, targetObject = UserSubscription.class) })
|
||||
public class PendingUserSubscription extends InitialPendingUserSubscription
|
||||
|
@ -74,5 +73,4 @@ public class PendingUserSubscription extends InitialPendingUserSubscription
|
|||
super(subscription, currentUser);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterable
|
|||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
@ -88,7 +89,7 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
|
|||
private void deleteAssociationToSubscription(String id)
|
||||
throws RegistryHandlerException {
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setAssociationType(AssociationTypes.RELATED_TO_PATH);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(false);
|
||||
|
||||
|
@ -117,7 +118,7 @@ public abstract class BasePendingSubscriptionHandler<T extends InitialPendingSub
|
|||
throws RegistryHandlerException {
|
||||
// Checks for the existence of a pending subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setAssociationType(AssociationTypes.RELATED_TO_PATH);
|
||||
query.setTargetObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 18, 2012 1169 djohnson Initial creation
|
||||
* Sep 24, 2012 1157 mpduff Changed to use InitialPendingSubscription.
|
||||
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -44,8 +44,11 @@ import com.raytheon.uf.common.util.CollectionUtil;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2013 1841 djohnson Initial creation
|
||||
* Sep 17, 2012 1169 djohnson Initial creation.
|
||||
* Sep 24, 2012 1157 mpduff Change to use InitialPendingSubscription.
|
||||
* Oct 17, 2012 0726 djohnson Add {@link #getActiveByDataSetAndProvider}.
|
||||
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
|
||||
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -129,8 +132,7 @@ public class SubscriptionHandler implements ISubscriptionHandler {
|
|||
*/
|
||||
@Override
|
||||
public Subscription getByName(String name) throws RegistryHandlerException {
|
||||
Subscription value = userSubscriptionHandler
|
||||
.getByName(name);
|
||||
Subscription value = userSubscriptionHandler.getByName(name);
|
||||
if (value == null) {
|
||||
value = sharedSubscriptionHandler.getByName(name);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|||
import com.raytheon.uf.common.datadelivery.registry.ebxml.SubscriptionFilterableQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.AssociationQuery;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.handler.IRegistryObjectHandler;
|
||||
|
@ -72,7 +73,7 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
|
|||
throws RegistryHandlerException {
|
||||
// Checks for the existence of the subscription
|
||||
AssociationQuery query = new AssociationQuery();
|
||||
query.setAssociationType(RegistryUtil.PATH_ASSOCIATION_RELATED_TO);
|
||||
query.setAssociationType(AssociationTypes.RELATED_TO_PATH);
|
||||
query.setSourceObjectId(id);
|
||||
query.setReturnObjects(true);
|
||||
|
||||
|
@ -122,9 +123,8 @@ public abstract class SubscriptionTypeHandler<T extends Subscription, QUERY exte
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<T> getActiveByDataSetAndProvider(
|
||||
String dataSetName, String providerName)
|
||||
throws RegistryHandlerException {
|
||||
public List<T> getActiveByDataSetAndProvider(String dataSetName,
|
||||
String providerName) throws RegistryHandlerException {
|
||||
SubscriptionFilterableQuery<T> query = getQuery();
|
||||
query.setDataSetName(dataSetName);
|
||||
query.setProviderName(providerName);
|
||||
|
|
|
@ -7,10 +7,12 @@ Bundle-Vendor: RAYTHEON
|
|||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Export-Package: com.raytheon.uf.common.registry,
|
||||
com.raytheon.uf.common.registry.annotations,
|
||||
com.raytheon.uf.common.registry.constants,
|
||||
com.raytheon.uf.common.registry.ebxml,
|
||||
com.raytheon.uf.common.registry.ebxml.encoder,
|
||||
com.raytheon.uf.common.registry.ebxml.slots,
|
||||
com.raytheon.uf.common.registry.handler
|
||||
com.raytheon.uf.common.registry.handler,
|
||||
com.raytheon.uf.common.registry.services
|
||||
Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
|
@ -23,5 +25,6 @@ Require-Bundle: org.apache.commons.codec;bundle-version="1.4.0",
|
|||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
org.apache.http;bundle-version="4.1.2",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
org.springframework;bundle-version="2.5.6"
|
||||
org.springframework;bundle-version="2.5.6",
|
||||
org.apache.commons.lang;bundle-version="2.3.0"
|
||||
Import-Package: com.vividsolutions.jts.geom
|
||||
|
|
|
@ -1,37 +1,35 @@
|
|||
package com.raytheon.uf.common.registry.annotations;
|
||||
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
|
||||
/**
|
||||
* Annotation for specifying the relationship between to RegistyObject
|
||||
* classes.
|
||||
* Annotation for specifying the relationship between to RegistyObject classes.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 15, 2012 jspinks Initial creation
|
||||
*
|
||||
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author jspinks
|
||||
* @version 1.0
|
||||
*
|
||||
* @see RegistryObject
|
||||
*/
|
||||
public @interface AssociationMapping {
|
||||
|
||||
|
||||
/**
|
||||
* The Class of the target RegitryObject type.
|
||||
*
|
||||
* @return The Class to use to create the association with.
|
||||
*/
|
||||
public Class<?> targetObject();
|
||||
|
||||
|
||||
/**
|
||||
* The names of the attributes that will be used to create the target
|
||||
* objects key information.
|
||||
|
@ -39,21 +37,22 @@ public @interface AssociationMapping {
|
|||
* @return An array of field names.
|
||||
*/
|
||||
public String[] keyFields();
|
||||
|
||||
|
||||
/**
|
||||
* The association type name for the association. The type must be
|
||||
* the id of the Scheme
|
||||
* The association type name for the association. The type must be the id of
|
||||
* the Scheme
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String associationType() default RegistryUtil.ASSOCIATION_CONTAINS;
|
||||
|
||||
public String associationType() default AssociationTypes.CONTAINS;
|
||||
|
||||
/**
|
||||
* Whether or not the association is required to exist. If true,
|
||||
* any attempt to store a RegistryObject with the required attribute
|
||||
* set to true where the target object cannot be found should result
|
||||
* in the store attempt failing.
|
||||
* Whether or not the association is required to exist. If true, any attempt
|
||||
* to store a RegistryObject with the required attribute set to true where
|
||||
* the target object cannot be found should result in the store attempt
|
||||
* failing.
|
||||
*
|
||||
* @return Whether or not the association is required.
|
||||
* @return Whether or not the association is required.
|
||||
*/
|
||||
public boolean required() default false;
|
||||
public boolean required() default false;
|
||||
}
|
||||
|
|
|
@ -7,27 +7,25 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
import com.raytheon.uf.common.registry.RegistryManager;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryObjectResolver;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An annotation that indicates that an association relationship exists
|
||||
* between two registry objects. The nature of that relationship is
|
||||
* described by two arguments: An AssociationResolver and an association
|
||||
* type.
|
||||
* An annotation that indicates that an association relationship exists between
|
||||
* two registry objects. The nature of that relationship is described by two
|
||||
* arguments: An AssociationResolver and an association type.
|
||||
*
|
||||
* The AssociationResolver is used to extract the registry object(s) that
|
||||
* are/will be associated with the object marked with the RegistryObjectAssociation
|
||||
* annotation. The association type is used to define the relationship
|
||||
* between the objects.
|
||||
* are/will be associated with the object marked with the
|
||||
* RegistryObjectAssociation annotation. The association type is used to define
|
||||
* the relationship between the objects.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 17, 2012 455 jspinks Initial creation
|
||||
* 4/9/2013 1802 bphillip Using constant values from constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -41,5 +39,6 @@ import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
|||
@Documented
|
||||
public @interface RegistryObjectAssociation {
|
||||
public Class<? extends RegistryObjectResolver> value();
|
||||
public String associationType() default RegistryUtil.ASSOCIATION_CONTAINS;
|
||||
|
||||
public String associationType() default AssociationTypes.CONTAINS;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 15, 2012 #363 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,6 +49,8 @@ public class AssociationTypes {
|
|||
|
||||
public static final String CONTAINS = "urn:oasis:names:tc:ebxml-regrep:AssociationType:Contains";
|
||||
|
||||
public static final String CONTAINS_PATH = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:AssociationType/Contains";
|
||||
|
||||
public static final String CONTENT_MANAGEMENT_SERVICE_FOR = "urn:oasis:names:tc:ebxml-regrep:AssociationType:ContentManagementServiceFor";
|
||||
|
||||
public static final String DESCRIBED_BY = "urn:oasis:names:tc:ebxml-regrep:AssociationType:DescribedBy";
|
||||
|
@ -98,6 +101,8 @@ public class AssociationTypes {
|
|||
|
||||
public static final String RELATED_TO = "urn:oasis:names:tc:ebxml-regrep:AssociationType:RelatedTo";
|
||||
|
||||
public static final String RELATED_TO_PATH = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:AssociationType/RelatedTo";
|
||||
|
||||
public static final String REPLACES = "urn:oasis:names:tc:ebxml-regrep:AssociationType:Replaces";
|
||||
|
||||
public static final String RESPONSIBLE_FOR = "urn:oasis:names:tc:ebxml-regrep:AssociationType:ResponsibleFor";
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -29,6 +29,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 29, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Registry canonical query types
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class CanonicalQueryTypes {
|
||||
|
||||
public static final String GET_OBJECT_BY_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetObjectById";
|
||||
|
||||
public static final String GET_OBJECTS_BY_LID = "urn:oasis:names:tc:ebxml-regrep:query:GetObjectsByLid";
|
||||
|
||||
public static final String GET_AUDIT_TRAIL_BY_LID = "urn:oasis:names:tc:ebxml-regrep:query:GetAuditTrailByLid";
|
||||
|
||||
public static final String GET_AUDIT_TRAIL_BY_TIME_INTERVAL = "urn:oasis:names:tc:ebxml-regrep:query:GetAuditTrailByTimeInterval";
|
||||
|
||||
public static final String GET_AUDIT_TRAIL_BY_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetAuditTrailById";
|
||||
|
||||
public static final String GET_CLASSIFICATION_SCHEMES_BY_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetClassificationSchemesById";
|
||||
|
||||
public static final String EXPORT_OBJECT = "urn:oasis:names:tc:ebxml-regrep:query:ExportObject";
|
||||
|
||||
public static final String GET_CHILDREN_BY_PARENT_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetChildrenByParentId";
|
||||
|
||||
public static final String GET_REGISTRY_PACKAGES_BY_MEMBER_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetRegistryPackagesByMemberId";
|
||||
|
||||
public static final String FIND_ALL_MY_OBJECTS = "urn:oasis:names:tc:ebxml-regrep:query:FindAllMyObjects";
|
||||
|
||||
public static final String GARBAGE_COLLECTOR = "urn:oasis:names:tc:ebxml-regrep:query:GarbageCollector";
|
||||
|
||||
public static final String BASIC_QUERY = "urn:oasis:names:tc:ebxml-regrep:query:BasicQuery";
|
||||
|
||||
public static final String EXTRINSIC_OBJECT_QUERY = "urn:oasis:names:tc:ebxml-regrep:query:ExtrinsicObjectQuery";
|
||||
|
||||
public static final String FIND_ASSOCIATIONS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociations";
|
||||
|
||||
public static final String FIND_ASSOCIATED_OBJECTS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociatedObjects";
|
||||
|
||||
public static final String ADHOC_QUERY = "urn:oasis:names:tc:ebxml-regrep:query:AdhocQuery";
|
||||
|
||||
public static final String KEYWORD_SEARCH = "urn:oasis:names:tc:ebxml-regrep:query:KeywordSearch";
|
||||
|
||||
public static final String REGISTRY_PACKAGE_SELECTOR = "urn:oasis:names:tc:ebxml-regrep:query:RegistryPackageSelector";
|
||||
|
||||
public static final String CLASSIFICATION_SCHEME_SELECTOR = "urn:oasis:names:tc:ebxml-regrep:query:ClassificationSchemeSelector";
|
||||
|
||||
public static final String GET_NOTIFICATION = "urn:oasis:names:tc:ebxml-regrep:query:GetNotification";
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
* This class holds the canonical ClassificationNodes are defined for the
|
||||
|
@ -32,6 +32,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/9/2012 184 bphillip Initial Coding
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Notification delivery types
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class DeliveryMethodTypes {
|
||||
|
||||
public static final String SOAP = "urn:oasis:names:tc:ebxml-regrep:endPointType:soap";
|
||||
|
||||
public static final String REST = "urn:oasis:names:tc:ebxml-regrep:endPointType:rest";
|
||||
|
||||
public static final String EMAIL = "urn:oasis:names:tc:ebxml-regrep:endPointType:mail";
|
||||
|
||||
public static final String PLUGIN = "urn:oasis:names:tc:ebxml-regrep:endPointType:plugin";
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
* This class holds the canonical ClassificationNodes are defined for the
|
||||
|
@ -31,6 +31,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 18, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Languages supported by the registry
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class Languages {
|
||||
|
||||
/**
|
||||
* The default language
|
||||
*/
|
||||
public static final String EN_US = "en-US";
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Namespace constants
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class Namespaces {
|
||||
|
||||
public static final String ADDRESSING_NAMESPACE = "http://www.w3.org/2005/08/addressing";
|
||||
|
||||
public static final String EBXML_REGISTRY_INTERFACES_NAMESPACE_URI = "urn:oasis:names:tc:ebxml-regrep:wsdl:registry:interfaces:4.0";
|
||||
|
||||
public static final String EBXML_SPI_NAMESPACE_URI = "urn:oasis:names:tc:ebxml-regrep:wsdl:spi:interfaces:4.0";
|
||||
|
||||
public static final String EBXML_NOTIFICATION_LISTENER_NAMESPACE_URI = "urn:oasis:names:tc:ebxml-regrep:wsdl:NotificationListener:interfaces:4.0";
|
||||
|
||||
public static final String EBXML_RS_NAMESPACE_URI = "urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0";
|
||||
|
||||
public static final String EBXML_RIM_NAMESPACE_URI = "urn:oasis:names:tc:ebxml-regrep:xsd:rim:4.0";
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Return types supported by registry queries
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class QueryReturnTypes {
|
||||
|
||||
public static final String OBJECT_REF = "ObjectRef";
|
||||
|
||||
public static final String REGISTRY_OBJECT = "RegistryObject";
|
||||
|
||||
public static final String LEAF_CLASS = "LeafClass";
|
||||
|
||||
public static final String LEAF_CLASS_WITH_REPOSITORY_ITEM = "LeafClassWithRepositoryItem";
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* 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.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
* Common registry errors
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class RegistryErrorMessage {
|
||||
|
||||
public static final String UNABLE_TO_CONNECT_TO_REGISTRY = "Unable to connect to the registry.";
|
||||
|
||||
public static final String FAILED_TO_CONNECT_TO_DATABASE = "Unable to connect to the database.";
|
||||
|
||||
public static final String DATABASE_ERROR_MESSAGE = "org.hibernate.exception.GenericJDBCException: Cannot open connection";
|
||||
}
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -38,6 +39,8 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
*/
|
||||
public class RegistryObjectTypes {
|
||||
|
||||
public static final String REGISTRY_OBJECT_PATH_PREFIX = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/";
|
||||
|
||||
public static final String REGISTRY_OBJECT = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject";
|
||||
|
||||
public static final String ASSOCIATION = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:Association";
|
|
@ -1,4 +1,4 @@
|
|||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
* This class holds the canonical ClassificationNodes are defined for the
|
||||
|
@ -14,6 +14,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/9/2012 184 bphillip Initial Coding
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -17,7 +17,7 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ package com.raytheon.uf.edex.registry.ebxml.constants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Moved into EBXML common plugin
|
||||
*
|
||||
* </pre>
|
||||
*
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* This package contains the canonical constants used for defining elements in the EBXML schema
|
||||
*/
|
||||
package com.raytheon.uf.edex.registry.ebxml.constants;
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
|
@ -11,6 +11,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
|
||||
import com.raytheon.uf.common.registry.BaseQuery;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
|
@ -29,6 +30,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* May 15, 2012 455 jspinks Added support for collection slots.
|
||||
* Jun 21, 2012 736 djohnson Add thrift serialization annotations.
|
||||
* Aug 02, 2012 955 djohnson Add generics and results retrieval to registry queries.
|
||||
* 4/9/2013 1802 bphillip Modified to use constants in constants package instead of RegistryUtil
|
||||
* </pre>
|
||||
*
|
||||
* @author jspinks
|
||||
|
@ -41,94 +43,106 @@ public abstract class AdhocRegistryQuery<T> extends BaseQuery<T> {
|
|||
private static String SLOT_CRITERIA_STRING_EQUALS = "slot%1$d.name='%2$s' and slot%1$d.slotValue.%3$s = %4$s and ";
|
||||
|
||||
private static String SLOT_CRITERIA_STRING_IN = "slot%1$d.name='%2$s' and slot%1$d.slotValue.%3$s in (%4$s) and ";
|
||||
|
||||
private static String SLOT_CRITERIA_STRING_LIKE = "slot%1$d.name='%2$s' and slot%1$d.slotValue.%3$s like %4$s and ";
|
||||
|
||||
|
||||
private static String COLLECTION_CRITERIA_STRING_EQUALS = "slot%1$d.name='%2$s' and collectionJoin%1$d.%3$s = %4$s and ";
|
||||
|
||||
private static String COLLECTION_CRITERIA_STRING_IN = "slot%1$d.name='%2$s' and collectionJoin%1$d.%3$s in (%4$s) and ";
|
||||
|
||||
private static String COLLECTION_CRITERIA_STRING_LIKE = "slot%1$d.name='%2$s' and collectionJoin%1$d.%3$s like %4$s and ";
|
||||
|
||||
protected static String FIND_OBJECTS_QUERY = "from RegistryObjectType as obj ";
|
||||
|
||||
protected static String FIND_OBJECTS_QUERY = "select obj from RegistryObjectType as obj ";
|
||||
|
||||
protected static String OBJECT_TYPE_CRITERIA = " where obj.objectType='%1$s' and ";
|
||||
|
||||
protected static String SLOT_JOIN_CLAUSE = " inner join obj.slot as slot%1$d ";
|
||||
|
||||
protected static String COLLECTION_JOIN_CLAUSE =
|
||||
" inner join obj.slot as slot%1$d " +
|
||||
" left join slot%1$d.slotValue.collectionValue collectionJoin%1$d ";
|
||||
|
||||
|
||||
protected static String COLLECTION_JOIN_CLAUSE = " inner join obj.slot as slot%1$d "
|
||||
+ " left join slot%1$d.slotValue.collectionValue collectionJoin%1$d ";
|
||||
|
||||
/**
|
||||
* Create the HQL for a QueryableAttribute.
|
||||
* Create the HQL for a QueryableAttribute.
|
||||
*
|
||||
* @param attribute
|
||||
* The QueryableAttribute to use.
|
||||
*
|
||||
* The QueryableAttribute to use.
|
||||
*
|
||||
* @param columnName
|
||||
* The slot name that is to be queried against.
|
||||
*
|
||||
* The slot name that is to be queried against.
|
||||
*
|
||||
* @param slotNumber
|
||||
* The join number of this criteria. Multiple slot criteria require the joining of
|
||||
* the slot table to aggregate the results properly.
|
||||
*
|
||||
* The join number of this criteria. Multiple slot criteria
|
||||
* require the joining of the slot table to aggregate the results
|
||||
* properly.
|
||||
*
|
||||
* @return The formatted line of HQL.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected static String formatCriteria(QueryableAttribute attribute, String columnName, int slotNumber) {
|
||||
protected static String formatCriteria(QueryableAttribute attribute,
|
||||
String columnName, int slotNumber) {
|
||||
String criteria;
|
||||
|
||||
if (attribute.collection) {
|
||||
|
||||
if (attribute.like) {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_LIKE, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
}
|
||||
else if (attribute.values != null) {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_IN, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
} else {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_EQUALS, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
}
|
||||
|
||||
|
||||
if (attribute.like) {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_LIKE,
|
||||
slotNumber, columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
} else if (attribute.values != null) {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_IN,
|
||||
slotNumber, columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
} else {
|
||||
criteria = String.format(COLLECTION_CRITERIA_STRING_EQUALS,
|
||||
slotNumber, columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (attribute.like) {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_LIKE, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
}
|
||||
else if (attribute.values != null) {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_IN, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
} else {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_EQUALS, slotNumber, columnName, attribute.getSlotValueType(), attribute.getQueryValue());
|
||||
}
|
||||
if (attribute.like) {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_LIKE, slotNumber,
|
||||
columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
} else if (attribute.values != null) {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_IN, slotNumber,
|
||||
columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
} else {
|
||||
criteria = String.format(SLOT_CRITERIA_STRING_EQUALS,
|
||||
slotNumber, columnName, attribute.getSlotValueType(),
|
||||
attribute.getQueryValue());
|
||||
}
|
||||
}
|
||||
return criteria;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@DynamicSerializeElement
|
||||
protected Map<String, QueryableAttribute<?>> attributes = new HashMap<String, QueryableAttribute<?>>();
|
||||
|
||||
|
||||
/**
|
||||
* Querying the registry requires the use of a QueryRequest Object.
|
||||
* This base Object supports different types of queries. This method
|
||||
* provides the RegistryManager a means to determine the query type
|
||||
* that should be used in conjunction with the slots provided by
|
||||
* the getSlots() method to produce the correct query to locate
|
||||
* registry Objects.
|
||||
*
|
||||
* Querying the registry requires the use of a QueryRequest Object. This
|
||||
* base Object supports different types of queries. This method provides the
|
||||
* RegistryManager a means to determine the query type that should be used
|
||||
* in conjunction with the slots provided by the getSlots() method to
|
||||
* produce the correct query to locate registry Objects.
|
||||
*
|
||||
* @return The constant "AdhocQuery" to mark queries generated using this
|
||||
* Class as adhoc.
|
||||
* Class as adhoc.
|
||||
*/
|
||||
@Override
|
||||
public String getQueryType() {
|
||||
return RegistryUtil.QUERY_TYPE_ADHOC;
|
||||
return CanonicalQueryTypes.ADHOC_QUERY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Querying the registry requires the use of a QueryRequest Object.
|
||||
* This Object queries the registry based on the slots add to the
|
||||
* query. This method provides the slots necessary to execute an
|
||||
* adhoc query using HQL.
|
||||
*
|
||||
* @return The slots to add to a QueryRequest to find the desired
|
||||
* registry Objects.
|
||||
* Querying the registry requires the use of a QueryRequest Object. This
|
||||
* Object queries the registry based on the slots add to the query. This
|
||||
* method provides the slots necessary to execute an adhoc query using HQL.
|
||||
*
|
||||
* @return The slots to add to a QueryRequest to find the desired registry
|
||||
* Objects.
|
||||
*/
|
||||
@Override
|
||||
public List<SlotType> getSlots() {
|
||||
|
@ -137,7 +151,7 @@ public abstract class AdhocRegistryQuery<T> extends BaseQuery<T> {
|
|||
slots.add(RegistryUtil.newStringSlot("queryExpression", getHQL()));
|
||||
return slots;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the HQL String used to query the registry.
|
||||
*
|
||||
|
@ -145,25 +159,27 @@ public abstract class AdhocRegistryQuery<T> extends BaseQuery<T> {
|
|||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected String getHQL() {
|
||||
|
||||
|
||||
// Build the HQL query..
|
||||
StringBuilder sb = new StringBuilder(FIND_OBJECTS_QUERY);
|
||||
List<String> criterias = new ArrayList<String>();
|
||||
|
||||
criterias.add(String.format(OBJECT_TYPE_CRITERIA, RegistryUtil.getObjectType(getObjectType())));
|
||||
criterias.add(String.format(OBJECT_TYPE_CRITERIA,
|
||||
RegistryUtil.getObjectType(getObjectType())));
|
||||
|
||||
for (String columnName : attributes.keySet()) {
|
||||
QueryableAttribute attribute = attributes.get(columnName);
|
||||
|
||||
|
||||
if (attribute.isCollection()) {
|
||||
sb.append(String.format(COLLECTION_JOIN_CLAUSE, criterias.size()));
|
||||
}
|
||||
else {
|
||||
sb.append(String.format(COLLECTION_JOIN_CLAUSE,
|
||||
criterias.size()));
|
||||
} else {
|
||||
sb.append(String.format(SLOT_JOIN_CLAUSE, criterias.size()));
|
||||
}
|
||||
criterias.add(formatCriteria(attribute, columnName, criterias.size()));
|
||||
criterias.add(formatCriteria(attribute, columnName,
|
||||
criterias.size()));
|
||||
}
|
||||
|
||||
|
||||
// Add the where clauses...
|
||||
for (String criteria : criterias) {
|
||||
sb.append(criteria);
|
||||
|
@ -175,18 +191,17 @@ public abstract class AdhocRegistryQuery<T> extends BaseQuery<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set attributes to use to query against.
|
||||
* Set attributes to use to query against.
|
||||
*
|
||||
* @param columnName
|
||||
* The name of the attribute to query against.
|
||||
*
|
||||
* The name of the attribute to query against.
|
||||
*
|
||||
* @param attribute
|
||||
* The QueryAttribute to use to generate the HQL needed to find
|
||||
* the desired registry Objects.
|
||||
* The QueryAttribute to use to generate the HQL needed to find
|
||||
* the desired registry Objects.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected
|
||||
void setAttribute(String columnName, QueryableAttribute attribute) {
|
||||
protected void setAttribute(String columnName, QueryableAttribute attribute) {
|
||||
attributes.put(columnName, attribute);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
|
||||
import com.raytheon.uf.common.registry.BaseQuery;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Jun 21, 2012 #736 djohnson Add thrift serialization annotations.
|
||||
* Aug 27, 2012 0743 djohnson Fixes to serializable attribute getter/setters.
|
||||
* Oct 05, 2012 1195 djohnson Remove see javadoc tie back to RegistryManager.
|
||||
* 4/9/2013 1802 bphillip Modified to use constants in constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,7 +51,7 @@ public class AssociationQuery extends BaseQuery<Object> {
|
|||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
protected String associationType;
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
protected String sourceObjectId;
|
||||
|
@ -57,22 +59,22 @@ public class AssociationQuery extends BaseQuery<Object> {
|
|||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
protected String sourceObjectType;
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
protected String targetObjectId;
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
protected String targetObjectType;
|
||||
|
||||
|
||||
/**
|
||||
* Queries of this type can return non-homogeneous results, so
|
||||
* the return type is Object. Runtime inspection of the returned
|
||||
* Objects is required to determine their type.
|
||||
* Queries of this type can return non-homogeneous results, so the return
|
||||
* type is Object. Runtime inspection of the returned Objects is required to
|
||||
* determine their type.
|
||||
*
|
||||
* @return The java typed Class Object to use to assign the
|
||||
* runtime type of the Objects retrieved from the registry.
|
||||
* @return The java typed Class Object to use to assign the runtime type of
|
||||
* the Objects retrieved from the registry.
|
||||
*/
|
||||
@Override
|
||||
public Class<Object> getObjectType() {
|
||||
|
@ -80,68 +82,71 @@ public class AssociationQuery extends BaseQuery<Object> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Querying the registry requires the use of a QueryRequest Object.
|
||||
* This base Object supports different types of queries. This method
|
||||
* provides the RegistryManager a means to determine the query type
|
||||
* that should be used in conjunction with the slots provided by
|
||||
* the getSlots() method to produce the correct query to locate
|
||||
* registry Objects.
|
||||
*
|
||||
* @return The constant "FindAssociatedObjects" to mark queries
|
||||
* generated using this Class as finding associated
|
||||
* objects.
|
||||
* Querying the registry requires the use of a QueryRequest Object. This
|
||||
* base Object supports different types of queries. This method provides the
|
||||
* RegistryManager a means to determine the query type that should be used
|
||||
* in conjunction with the slots provided by the getSlots() method to
|
||||
* produce the correct query to locate registry Objects.
|
||||
*
|
||||
* @return The constant "FindAssociatedObjects" to mark queries generated
|
||||
* using this Class as finding associated objects.
|
||||
*/
|
||||
@Override
|
||||
public String getQueryType() {
|
||||
if (returnObjects) {
|
||||
return RegistryUtil.QUERY_TYPE_ASSOCIATED_OBJECTS;
|
||||
return CanonicalQueryTypes.FIND_ASSOCIATED_OBJECTS;
|
||||
} else {
|
||||
return RegistryUtil.QUERY_TYPE_ASSOCIATIONS;
|
||||
return CanonicalQueryTypes.FIND_ASSOCIATIONS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Querying the registry requires the use of a QueryRequest Object.
|
||||
* This Object queries the registry based on the slots add to the
|
||||
* query. This method provides the slots necessary to execute a
|
||||
* FindAssociatedObjects query.
|
||||
*
|
||||
* @return The slots to add to a QueryRequest to find the desired
|
||||
* registry Objects.
|
||||
* Querying the registry requires the use of a QueryRequest Object. This
|
||||
* Object queries the registry based on the slots add to the query. This
|
||||
* method provides the slots necessary to execute a FindAssociatedObjects
|
||||
* query.
|
||||
*
|
||||
* @return The slots to add to a QueryRequest to find the desired registry
|
||||
* Objects.
|
||||
*/
|
||||
@Override
|
||||
public List<SlotType> getSlots() {
|
||||
List<SlotType> slots = new ArrayList<SlotType>();
|
||||
|
||||
if (sourceObjectId != null) {
|
||||
slots.add(RegistryUtil.newStringSlot("sourceObjectId", sourceObjectId));
|
||||
}
|
||||
slots.add(RegistryUtil.newStringSlot("sourceObjectId",
|
||||
sourceObjectId));
|
||||
}
|
||||
|
||||
if (targetObjectId != null) {
|
||||
slots.add(RegistryUtil.newStringSlot("targetObjectId", targetObjectId));
|
||||
}
|
||||
slots.add(RegistryUtil.newStringSlot("targetObjectId",
|
||||
targetObjectId));
|
||||
}
|
||||
|
||||
if (sourceObjectType != null) {
|
||||
slots.add(RegistryUtil.newStringSlot("sourceObjectType", sourceObjectType));
|
||||
}
|
||||
slots.add(RegistryUtil.newStringSlot("sourceObjectType",
|
||||
sourceObjectType));
|
||||
}
|
||||
|
||||
if (targetObjectType != null) {
|
||||
slots.add(RegistryUtil.newStringSlot("targetObjectType", targetObjectType));
|
||||
}
|
||||
slots.add(RegistryUtil.newStringSlot("targetObjectType",
|
||||
targetObjectType));
|
||||
}
|
||||
|
||||
if (associationType != null) {
|
||||
slots.add(RegistryUtil.newStringSlot("associationType", associationType));
|
||||
}
|
||||
slots.add(RegistryUtil.newStringSlot("associationType",
|
||||
associationType));
|
||||
}
|
||||
|
||||
return slots;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the isReturnObjects attribute from this Query. If true,
|
||||
* when this Query is submitted to the <code>RegistryManager</code>
|
||||
* the resulting <code>List</code> will contain the referenced Objects
|
||||
* stored in the Registry. If false, a <code>List</code> of <code>AssociationType</code>
|
||||
* Objects will be returned.
|
||||
* Retrieve the isReturnObjects attribute from this Query. If true, when
|
||||
* this Query is submitted to the <code>RegistryManager</code> the resulting
|
||||
* <code>List</code> will contain the referenced Objects stored in the
|
||||
* Registry. If false, a <code>List</code> of <code>AssociationType</code>
|
||||
* Objects will be returned.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
|
@ -150,13 +155,13 @@ public class AssociationQuery extends BaseQuery<Object> {
|
|||
public boolean isReturnObjects() {
|
||||
return returnObjects;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Matches Associations whose type attribute references a ClassificationNode
|
||||
* where rim:ClassificationNode/@path matches specified value.
|
||||
*
|
||||
* where rim:ClassificationNode/@path matches specified value.
|
||||
*
|
||||
* @param associationType
|
||||
* The value of the associationType attribute to search for.
|
||||
* The value of the associationType attribute to search for.
|
||||
*/
|
||||
public void setAssociationType(String associationType) {
|
||||
this.associationType = associationType;
|
||||
|
@ -174,56 +179,56 @@ public class AssociationQuery extends BaseQuery<Object> {
|
|||
}
|
||||
|
||||
/**
|
||||
* A setter for the queryable attribute source object id equals a
|
||||
* String. The String may contain the wildcard characters '%', to
|
||||
* match multiple characters, or '?' to wildcard a single character.
|
||||
* A setter for the queryable attribute source object id equals a String.
|
||||
* The String may contain the wildcard characters '%', to match multiple
|
||||
* characters, or '?' to wildcard a single character.
|
||||
*
|
||||
* For the AssociationQuery to execute correctly, one of the attributes
|
||||
* sourceObjectId or targetObjectId MUST be set.
|
||||
*
|
||||
*
|
||||
* @param sourceObjectId
|
||||
* The value of the sourceObjectId attribute to search for.
|
||||
* The value of the sourceObjectId attribute to search for.
|
||||
*/
|
||||
public void setSourceObjectId(String sourceObjectId) {
|
||||
this.sourceObjectId = sourceObjectId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Match associations whose sourceObject attribute references a
|
||||
* RegistryObject whose objectType attribute matches the id of the
|
||||
* ClassificationNode where rim:ClassificationNode/@path matches
|
||||
* specified value
|
||||
*
|
||||
* Match associations whose sourceObject attribute references a
|
||||
* RegistryObject whose objectType attribute matches the id of the
|
||||
* ClassificationNode where rim:ClassificationNode/@path matches specified
|
||||
* value
|
||||
*
|
||||
* @param sourceObjectId
|
||||
* The value of the path attribute to search for.
|
||||
* The value of the path attribute to search for.
|
||||
*/
|
||||
public void setSourceObjectType(String sourceObjectType) {
|
||||
this.sourceObjectType = sourceObjectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* A setter for the queryable attribute target object id equals a
|
||||
* String. The String may contain the wildcard characters '%', to
|
||||
* match multiple characters, or '?' to wildcard a single character.
|
||||
*
|
||||
* A setter for the queryable attribute target object id equals a String.
|
||||
* The String may contain the wildcard characters '%', to match multiple
|
||||
* characters, or '?' to wildcard a single character.
|
||||
*
|
||||
* For the AssociationQuery to execute correctly, one of the attributes
|
||||
* sourceObjectId or targetObjectId MUST be set.
|
||||
*
|
||||
* @param targetObjectId
|
||||
* The value of the targetObjectId attribute to search for.
|
||||
* The value of the targetObjectId attribute to search for.
|
||||
*/
|
||||
public void setTargetObjectId(String targetObjectId) {
|
||||
this.targetObjectId = targetObjectId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Match associations whose targetObject attribute references a
|
||||
* RegistryObject whose objectType attribute matches the id of the
|
||||
* ClassificationNode where rim:ClassificationNode/@path matches
|
||||
* specified value
|
||||
*
|
||||
* Match associations whose targetObject attribute references a
|
||||
* RegistryObject whose objectType attribute matches the id of the
|
||||
* ClassificationNode where rim:ClassificationNode/@path matches specified
|
||||
* value
|
||||
*
|
||||
* @param targetObjectType
|
||||
* The value of the path attribute to search for.
|
||||
* The value of the path attribute to search for.
|
||||
*/
|
||||
public void setTargetObjectType(String targetObjectType) {
|
||||
this.targetObjectType = targetObjectType;
|
||||
|
|
|
@ -46,6 +46,9 @@ import com.raytheon.uf.common.registry.RegistryQuery;
|
|||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.annotations.RegistryObject;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -73,6 +76,7 @@ import com.raytheon.uf.common.util.ReflectionException;
|
|||
* Feb 26, 2013 1643 djohnson Remove registry manager debug toggle.
|
||||
* 3/18/2013 1802 bphillip Implemented transaction boundaries
|
||||
* 3/27/2013 1802 bphillip Changed visibility of processRequest and fixed catch block to catch the correct Exception type
|
||||
* 4/9/2013 1802 bphillip Modified to use constants in constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -192,7 +196,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
QueryRequest q = RegistryUtil.getQuery(query);
|
||||
QueryResponse r = qm.executeQuery(q);
|
||||
|
||||
if (RegistryUtil.RESPONSE_SUCCESS.equals(r.getStatus())
|
||||
if (RegistryResponseStatus.SUCCESS.equals(r.getStatus())
|
||||
&& r.getRegistryObjectList() != null) {
|
||||
return r.getRegistryObjectList().getRegistryObject();
|
||||
}
|
||||
|
@ -275,7 +279,8 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
} catch (WebServiceException e) {
|
||||
calledResponse = RegistryUtil.getFailedResponse(response,
|
||||
new RegistryException(
|
||||
RegistryUtil.UNABLE_TO_CONNECT_TO_REGISTRY, e));
|
||||
RegistryErrorMessage.UNABLE_TO_CONNECT_TO_REGISTRY,
|
||||
e));
|
||||
} catch (CommunicationException e) {
|
||||
calledResponse = RegistryUtil.getFailedResponse(response, e);
|
||||
} catch (Throwable e) {
|
||||
|
@ -471,7 +476,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
|
||||
QueryResponse r = qm.executeQuery(query);
|
||||
|
||||
if (RegistryUtil.RESPONSE_SUCCESS.equals(r.getStatus())) {
|
||||
if (RegistryResponseStatus.SUCCESS.equals(r.getStatus())) {
|
||||
|
||||
if (r.getRegistryObjectList() != null
|
||||
&& r.getRegistryObjectList().getRegistryObject() != null) {
|
||||
|
@ -528,7 +533,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
LifecycleManager a = lifecycleManagerFactory.getLifeCycleManager();
|
||||
RegistryResponseType r = a.removeObjects(deleteRequest);
|
||||
|
||||
if (RegistryUtil.RESPONSE_SUCCESS.equals(r.getStatus())) {
|
||||
if (RegistryResponseStatus.SUCCESS.equals(r.getStatus())) {
|
||||
response.setStatus(OperationStatus.SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -776,13 +781,13 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
objects = getRawObjects(qm, idQuery);
|
||||
if (objects.isEmpty()) {
|
||||
rt = submitObjects(lcm, Arrays.asList(classificationNode));
|
||||
if (!RegistryUtil.RESPONSE_SUCCESS.equals(rt.getStatus())) {
|
||||
if (!RegistryResponseStatus.SUCCESS.equals(rt.getStatus())) {
|
||||
throwUnsuccessfulResponseException(rt);
|
||||
}
|
||||
}
|
||||
|
||||
rt = submitObjects(lcm, Arrays.asList(registryObject));
|
||||
if (!RegistryUtil.RESPONSE_SUCCESS.equals(rt.getStatus())) {
|
||||
if (!RegistryResponseStatus.SUCCESS.equals(rt.getStatus())) {
|
||||
throwUnsuccessfulResponseException(rt);
|
||||
}
|
||||
|
||||
|
@ -799,7 +804,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
rt = submitObjects(lcm, associations, mode);
|
||||
}
|
||||
|
||||
if (!RegistryUtil.RESPONSE_SUCCESS.equals(rt.getStatus())) {
|
||||
if (!RegistryResponseStatus.SUCCESS.equals(rt.getStatus())) {
|
||||
throwUnsuccessfulResponseException(rt);
|
||||
}
|
||||
}
|
||||
|
@ -811,7 +816,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
// associations are stored. First, get the current associations.
|
||||
List<RegistryObjectType> existingAssociations = getAssociations(qm,
|
||||
registryObject.getId(), null,
|
||||
RegistryUtil.PATH_ASSOCIATION_CONTAINS);
|
||||
AssociationTypes.CONTAINS_PATH);
|
||||
|
||||
// Get the targetObjectIds from the existing associations and
|
||||
// resolve that Set against the new list of target associations
|
||||
|
@ -959,7 +964,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
response.setObjectRefList(new ObjectRefListType());
|
||||
response.setRegistryObjectList(new RegistryObjectListType());
|
||||
response.setException(new ArrayList<RegistryExceptionType>());
|
||||
response.setStatus(RegistryUtil.RESPONSE_SUCCESS);
|
||||
response.setStatus(RegistryResponseStatus.SUCCESS);
|
||||
|
||||
if (registryObjects != null && registryObjects.size() > 0) {
|
||||
|
||||
|
@ -976,7 +981,7 @@ public class FactoryRegistryHandler implements RegistryHandler {
|
|||
|
||||
RegistryResponseType rt = lifecycleManager.submitObjects(a);
|
||||
|
||||
if (RegistryUtil.RESPONSE_SUCCESS.equals(rt.getStatus())) {
|
||||
if (RegistryResponseStatus.SUCCESS.equals(rt.getStatus())) {
|
||||
// Accumulate the ObjectRefList and RegistryObjectList
|
||||
// returns
|
||||
// from each sub-submit to aggregate back into a full
|
||||
|
|
|
@ -27,6 +27,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringValueType;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.registry.OperationStatus;
|
||||
import com.raytheon.uf.common.registry.RegistryException;
|
||||
import com.raytheon.uf.common.registry.RegistryQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
|
@ -38,6 +39,10 @@ import com.raytheon.uf.common.registry.annotations.RegistryObjectName;
|
|||
import com.raytheon.uf.common.registry.annotations.RegistryObjectOwner;
|
||||
import com.raytheon.uf.common.registry.annotations.SlotAttribute;
|
||||
import com.raytheon.uf.common.registry.annotations.SlotAttributeConverter;
|
||||
import com.raytheon.uf.common.registry.constants.Languages;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.encoder.IRegistryEncoder;
|
||||
import com.raytheon.uf.common.registry.ebxml.slots.BooleanSlotConverter;
|
||||
import com.raytheon.uf.common.registry.ebxml.slots.DateSlotConverter;
|
||||
|
@ -47,13 +52,10 @@ import com.raytheon.uf.common.registry.ebxml.slots.IntegerSlotConverter;
|
|||
import com.raytheon.uf.common.registry.ebxml.slots.SlotConverter;
|
||||
import com.raytheon.uf.common.registry.ebxml.slots.StringSlotConverter;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.common.util.ReflectionException;
|
||||
import com.raytheon.uf.common.util.ReflectionUtil;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
|
||||
/**
|
||||
* Utility class for common Registry activities.
|
||||
|
@ -72,6 +74,7 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
* Aug 20, 2012 0743 djohnson Slot converter for {@link ImmutableDate}, and enumerations.
|
||||
* Sep 07, 2012 1102 djohnson Check in hanging around encoding strategy code that will prove useful later.
|
||||
* Oct 05, 2012 1195 djohnson Don't persist slots for null values.
|
||||
* 4/9/2013 1802 bphillip Pulled constants out into existing constants package that was moved into common
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,105 +83,15 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
*/
|
||||
public final class RegistryUtil {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistryUtil.class);
|
||||
|
||||
private RegistryUtil() {
|
||||
// Prevent Instantiation
|
||||
}
|
||||
|
||||
/**
|
||||
* The default launguge
|
||||
*/
|
||||
public static final String EN_US = "en-US";
|
||||
|
||||
/**
|
||||
* The default internal owner
|
||||
*/
|
||||
public static final String DEFAULT_OWNER = "EDEX_Internal_User";
|
||||
|
||||
/**
|
||||
* Constant for the association type of "contains"
|
||||
*/
|
||||
public static final String ASSOCIATION_CONTAINS = "urn:oasis:names:tc:ebxml-regrep:AssociationType:Contains";
|
||||
|
||||
/**
|
||||
* Constant for the association type of "RelatedTo"
|
||||
*/
|
||||
public static final String ASSOCIATION_RELATED_TO = "urn:oasis:names:tc:ebxml-regrep:AssociationType:RelatedTo";
|
||||
|
||||
public static final String CLASSIFICATION_SCHEME_OBJECT_TYPE = "urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType";
|
||||
|
||||
/**
|
||||
* Constant for the delete repository item only option on delete requests.
|
||||
*/
|
||||
public static final String DELETE_REPOSITORY_ITEM_ONLY = "DeleteRepositoryItemOnly";
|
||||
|
||||
public static final String NODE_TYPE_UNIQUE_CODE = "urn:oasis:names:tc:ebxml-regrep:NodeType:UniqueCode";
|
||||
|
||||
/**
|
||||
* Constant for the path of the classificationNode for the association type
|
||||
* of "contains"
|
||||
*/
|
||||
public static final String PATH_ASSOCIATION_CONTAINS = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:AssociationType/Contains";
|
||||
|
||||
/**
|
||||
* Constant for the path of the classificationNode for the association type
|
||||
* of "related to"
|
||||
*/
|
||||
public static final String PATH_ASSOCIATION_RELATED_TO = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:AssociationType/RelatedTo";
|
||||
|
||||
/**
|
||||
* Constant for the path of the classificationNode for 'ObjectType'
|
||||
*/
|
||||
public static final String PATH_REGISTRY_OBJECT_TYPE_PREFIX = "/urn:oasis:names:tc:ebxml-regrep:classificationScheme:ObjectType/RegistryObject/";
|
||||
|
||||
/**
|
||||
* Constant for the adhoc query type.
|
||||
*/
|
||||
public static final String QUERY_TYPE_ADHOC = "urn:oasis:names:tc:ebxml-regrep:query:AdhocQuery";
|
||||
|
||||
public static final String QUERY_TYPE_ASSOCIATIONS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociations";
|
||||
|
||||
public static final String QUERY_TYPE_ASSOCIATED_OBJECTS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociatedObjects";
|
||||
|
||||
/**
|
||||
* Constant for the basic query type.
|
||||
*/
|
||||
public static final String QUERY_TYPE_BASIC = "urn:oasis:names:tc:ebxml-regrep:query:BasicQuery";
|
||||
|
||||
/**
|
||||
* Constant for the query by id query type.
|
||||
*/
|
||||
public static final String QUERY_TYPE_BYID = "urn:oasis:names:tc:ebxml-regrep:query:GetObjectById";
|
||||
|
||||
public static final String REGISTRY_OBJECT_CLASSIFICATION_NODE_PREFIX = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject";
|
||||
|
||||
public static final String REGISTRY_OBJECT_TYPE_CLASSIFICATION_NODE = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ClassificationNode";
|
||||
|
||||
public static final String REGISTRY_OBJECT_TYPE_CLASSIFICATION_SCHEME = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject:ClassificationScheme";
|
||||
|
||||
public static final String REGISTRY_OBJECT_TYPE_PREFIX = "urn:oasis:names:tc:ebxml-regrep:ObjectType:RegistryObject";
|
||||
|
||||
/**
|
||||
* Constant for the response status of success returned by the registry.
|
||||
*/
|
||||
public static final String RESPONSE_SUCCESS = "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success";
|
||||
|
||||
public static final String UNABLE_TO_CONNECT_TO_REGISTRY = "Unable to connect to the registry.";
|
||||
|
||||
public static final String FAILED_TO_CONNECT_TO_DATABASE = "Unable to connect to the database.";
|
||||
|
||||
public static final String DATABASE_ERROR_MESSAGE = "org.hibernate.exception.GenericJDBCException: Cannot open connection";
|
||||
|
||||
private static final String REGISTRY_OBJECT = RegistryObject.class
|
||||
.getSimpleName();
|
||||
|
||||
private static final String NAMESPACE_SEPARATOR = ":";
|
||||
|
||||
private static final int NAMESPACE_SEPARATOR_LENGTH = NAMESPACE_SEPARATOR
|
||||
.length();
|
||||
|
||||
// A private mapping of attribute types to slot types, used when storing an
|
||||
// object to the registry to map QueryableAttributes to SlotConverters.
|
||||
private static final Map<String, SlotConverter> SLOT_CONVERSION;
|
||||
|
@ -211,6 +124,29 @@ public final class RegistryUtil {
|
|||
@VisibleForTesting
|
||||
static IRegistryEncoder ENCODER_STRATEGY;
|
||||
|
||||
/**
|
||||
* Creates a slot of the given type.
|
||||
*
|
||||
* @param slotType
|
||||
* The type of slot to create
|
||||
* @param slotName
|
||||
* The name of the slot
|
||||
* @param slotValue
|
||||
* The value of the slot
|
||||
* @return The SlotType object
|
||||
* @throws Exception
|
||||
* If errors occur while creating the slot
|
||||
*/
|
||||
public static SlotType getSlot(String slotType, String slotName,
|
||||
Object slotValue) {
|
||||
SlotConverter converter = SLOT_CONVERSION.get(slotType);
|
||||
if (converter == null) {
|
||||
throw new RegistryException("Not slot converter for type "
|
||||
+ slotType);
|
||||
}
|
||||
return converter.getSlots(slotName, slotValue).get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the encoder strategy to use. This method should only be called once
|
||||
* via Spring initialization.
|
||||
|
@ -284,12 +220,11 @@ public final class RegistryUtil {
|
|||
* @return A registry object type.
|
||||
*/
|
||||
public static String getObjectType(Class<?> object) {
|
||||
return REGISTRY_OBJECT_TYPE_PREFIX + NAMESPACE_SEPARATOR
|
||||
+ object.getName();
|
||||
return RegistryObjectTypes.REGISTRY_OBJECT + ":" + object.getName();
|
||||
}
|
||||
|
||||
public static String getObjectTypePath(Class<?> object) {
|
||||
return PATH_REGISTRY_OBJECT_TYPE_PREFIX + object.getName();
|
||||
return RegistryObjectTypes.REGISTRY_OBJECT + object.getName();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -308,7 +243,7 @@ public final class RegistryUtil {
|
|||
queryRequest.setId(RegistryUtil.generateRegistryObjectId());
|
||||
ResponseOptionType responseOption = new ResponseOptionType();
|
||||
responseOption.setReturnComposedObjects(true);
|
||||
responseOption.setReturnType(REGISTRY_OBJECT);
|
||||
responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
|
||||
|
||||
QueryType query = new QueryType();
|
||||
query.setQueryDefinition(registryQuery.getQueryType());
|
||||
|
@ -468,7 +403,7 @@ public final class RegistryUtil {
|
|||
// Objects
|
||||
// more easily.
|
||||
registryObject
|
||||
.setObjectType(REGISTRY_OBJECT_CLASSIFICATION_NODE_PREFIX
|
||||
.setObjectType(RegistryObjectTypes.REGISTRY_OBJECT
|
||||
+ ":" + registryObjectType);
|
||||
|
||||
String objectOwner = ReflectionUtil.getAnnotatedField(
|
||||
|
@ -673,11 +608,10 @@ public final class RegistryUtil {
|
|||
ClassificationNodeType node = new ClassificationNodeType();
|
||||
node.setId(objectType);
|
||||
node.setLid(objectType);
|
||||
node.setParent(REGISTRY_OBJECT_CLASSIFICATION_NODE_PREFIX);
|
||||
node.setParent(RegistryObjectTypes.REGISTRY_OBJECT);
|
||||
// Add the namespace separator length to get the correct substring
|
||||
node.setCode(objectType
|
||||
.substring(REGISTRY_OBJECT_CLASSIFICATION_NODE_PREFIX.length()
|
||||
+ NAMESPACE_SEPARATOR_LENGTH));
|
||||
node.setCode(objectType.substring(RegistryObjectTypes.REGISTRY_OBJECT
|
||||
.length() + 1));
|
||||
|
||||
return node;
|
||||
}
|
||||
|
@ -787,7 +721,7 @@ public final class RegistryUtil {
|
|||
R response, CommunicationException e) {
|
||||
String message = e.getMessage();
|
||||
String errorMessage = (message
|
||||
.indexOf(RegistryUtil.DATABASE_ERROR_MESSAGE) != -1) ? RegistryUtil.FAILED_TO_CONNECT_TO_DATABASE
|
||||
.indexOf(RegistryErrorMessage.DATABASE_ERROR_MESSAGE) != -1) ? RegistryErrorMessage.FAILED_TO_CONNECT_TO_DATABASE
|
||||
: message;
|
||||
return getFailedResponse(response, new RegistryException(errorMessage,
|
||||
e));
|
||||
|
@ -801,7 +735,7 @@ public final class RegistryUtil {
|
|||
* @return The new InternationalStringType instance
|
||||
*/
|
||||
public static InternationalStringType getInternationalString(String str) {
|
||||
return getInternationalString(str, EN_US);
|
||||
return getInternationalString(str, Languages.EN_US);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.raytheon.uf.common.registry.RegistryHandler;
|
|||
import com.raytheon.uf.common.registry.RegistryQuery;
|
||||
import com.raytheon.uf.common.registry.RegistryQueryResponse;
|
||||
import com.raytheon.uf.common.registry.RegistryResponse;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryErrorMessage;
|
||||
import com.raytheon.uf.common.serialization.ExceptionWrapper;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.comm.RequestRouter;
|
||||
|
@ -43,6 +44,7 @@ import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
|||
* Sep 28, 2012 1187 djohnson Break out reusable thrift communication code to ThriftCommunicator.
|
||||
* Nov 15, 2012 1322 djohnson Remove ThriftCommunicator in lieu of server-keyed routing.
|
||||
* Dec 03, 2012 1379 djohnson Use registry service keys.
|
||||
* 4/9/2013 1802 bphillip Modified to use constants in constants package instead of RegistryUtil
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -78,8 +80,11 @@ public class ThriftRegistryHandler implements RegistryHandler {
|
|||
|
||||
if (cause instanceof HttpHostConnectException) {
|
||||
return RegistryUtil
|
||||
.getFailedResponse(response, new RegistryException(
|
||||
RegistryUtil.UNABLE_TO_CONNECT_TO_REGISTRY, re));
|
||||
.getFailedResponse(
|
||||
response,
|
||||
new RegistryException(
|
||||
RegistryErrorMessage.UNABLE_TO_CONNECT_TO_REGISTRY,
|
||||
re));
|
||||
} else if (cause instanceof CommunicationException) {
|
||||
return RegistryUtil.getFailedResponse(response,
|
||||
(CommunicationException) cause);
|
||||
|
|
|
@ -0,0 +1,482 @@
|
|||
/**
|
||||
* 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.common.registry.services;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
||||
import javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Cataloger;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Validator;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* Convenience class used for accessing the registry soap services
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class RegistrySOAPServices {
|
||||
|
||||
/** The logger */
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistrySOAPServices.class);
|
||||
|
||||
/** The HTTP prefix */
|
||||
private static final String HTTP = "http://";
|
||||
|
||||
/** Path separator */
|
||||
private static final String PATH_SEPARATOR = "/";
|
||||
|
||||
/** WSDL suffix */
|
||||
private static final String WSDL = "?wsdl";
|
||||
|
||||
/** The name of the notification listener service */
|
||||
private static final String NOTIFICATION_SERVICE_NAME = "notificationListener";
|
||||
|
||||
/** The name of the lifecycle manager service */
|
||||
private static final String LIFECYCLE_MANAGER_SERVICE_NAME = "lifecycleManager";
|
||||
|
||||
/** The name of the cataloger service */
|
||||
private static final String CATALOGER_SERVICE_NAME = "cataloger";
|
||||
|
||||
/** The name of the query service */
|
||||
private static final String QUERY_SERVICE_NAME = "queryManager";
|
||||
|
||||
/** The name of the validator service */
|
||||
private static final String VALIDATOR_SERVICE_NAME = "validator";
|
||||
|
||||
/** Map of known notification services */
|
||||
private static Map<URL, NotificationListener> notificationServiceMap = new ConcurrentHashMap<URL, NotificationListener>();
|
||||
|
||||
/** Map of known lifecycle manager services */
|
||||
private static Map<URL, LifecycleManager> lifecycleManagerServiceMap = new ConcurrentHashMap<URL, LifecycleManager>();
|
||||
|
||||
/** Map of known cataloger services */
|
||||
private static Map<URL, Cataloger> catalogerServiceMap = new ConcurrentHashMap<URL, Cataloger>();
|
||||
|
||||
/** Map of known query services */
|
||||
private static Map<URL, QueryManager> queryServiceMap = new ConcurrentHashMap<URL, QueryManager>();
|
||||
|
||||
/** Map of known validator services */
|
||||
private static Map<URL, Validator> validatorServiceMap = new ConcurrentHashMap<URL, Validator>();
|
||||
|
||||
/**
|
||||
* Gets the notification listener service URL for the given host
|
||||
*
|
||||
* @param host
|
||||
* The host
|
||||
* @return The notification listener service URL for the given host
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static String getNotificationListenerServiceUrl(final String host)
|
||||
throws MalformedURLException {
|
||||
return new URL(HTTP + host + PATH_SEPARATOR + NOTIFICATION_SERVICE_NAME)
|
||||
.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notification listener service for the given host
|
||||
*
|
||||
* @param host
|
||||
* The host to get the notification listener service for
|
||||
* @return The notification listener service for the given host
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static NotificationListener getNotificationListenerServiceForHost(
|
||||
final String host) throws MalformedURLException {
|
||||
return getNotificationListenerServiceForUrl(getNotificationListenerServiceUrl(host));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notification listener service at the given URL string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* The url
|
||||
* @return The notification listener service at the given URL
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static NotificationListener getNotificationListenerServiceForUrl(
|
||||
final String url) throws MalformedURLException {
|
||||
return getNotificationListener(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notification listener service at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The notification listener service URL
|
||||
* @return The notification listener service at the given URL
|
||||
*/
|
||||
private static NotificationListener getNotificationListener(URL url) {
|
||||
NotificationListener notificationListener = notificationServiceMap
|
||||
.get(url);
|
||||
if (notificationListener == null) {
|
||||
notificationListener = getPort(url, NotificationListener.class);
|
||||
notificationServiceMap.put(url, notificationListener);
|
||||
}
|
||||
return notificationListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lifecycle manager service for the given host
|
||||
*
|
||||
* @param host
|
||||
* The host to get the lifecycle manager service for
|
||||
* @return The lifecycle manager service for the given host
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static LifecycleManager getLifecycleManagerServiceForHost(
|
||||
final String host) throws MalformedURLException {
|
||||
return getLifecycleManager(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ LIFECYCLE_MANAGER_SERVICE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lifecycle manager service for the given URL string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* The service URL
|
||||
* @return The lifecycle manager service at the given URL string
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static LifecycleManager getLifecycleManagerServiceForUrl(
|
||||
final String url) throws MalformedURLException {
|
||||
return getLifecycleManager(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lifecycle manager service for at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The url
|
||||
* @return The lifecycle manager service at the given URL
|
||||
*/
|
||||
private static LifecycleManager getLifecycleManager(URL url) {
|
||||
LifecycleManager lcm = lifecycleManagerServiceMap.get(url);
|
||||
if (lcm == null) {
|
||||
lcm = getPort(url, LifecycleManager.class);
|
||||
lifecycleManagerServiceMap.put(url, lcm);
|
||||
}
|
||||
return lcm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cataloger service for the given host
|
||||
*
|
||||
* @param host
|
||||
* The host to get the cataloger service for
|
||||
* @return The cataloger service at the given host
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Cataloger getCatalogerServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getCataloger(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ CATALOGER_SERVICE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cataloger service for the given url string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* the url string
|
||||
* @return The cataloger service
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Cataloger getCatalogerServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getCataloger(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cataloger service at the given URL
|
||||
*
|
||||
* @param url
|
||||
* The URL
|
||||
* @return The cataloger service at the given URL
|
||||
*/
|
||||
private static Cataloger getCataloger(URL url) {
|
||||
Cataloger cataloger = catalogerServiceMap.get(url);
|
||||
if (cataloger == null) {
|
||||
cataloger = getPort(url, Cataloger.class);
|
||||
catalogerServiceMap.put(url, cataloger);
|
||||
}
|
||||
return cataloger;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query manager service at the given host
|
||||
*
|
||||
* @param host
|
||||
* The host name
|
||||
* @return The query manager service
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static QueryManager getQueryServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getQueryManager(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ QUERY_SERVICE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query manager service at the given url string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* The url string
|
||||
* @return The query manager service at the given url string
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static QueryManager getQueryServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getQueryManager(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the query manager service at the given url
|
||||
*
|
||||
* @param url
|
||||
* The url
|
||||
* @return The query manager service at the give URL
|
||||
*/
|
||||
private static QueryManager getQueryManager(URL url) {
|
||||
QueryManager queryManager = queryServiceMap.get(url);
|
||||
if (queryManager == null) {
|
||||
queryManager = getPort(url, QueryManager.class);
|
||||
queryServiceMap.put(url, queryManager);
|
||||
}
|
||||
return queryManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validator service for the given host
|
||||
*
|
||||
* @param host
|
||||
* The host
|
||||
* @return The validator service for the given host
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Validator getValidatorServiceForHost(final String host)
|
||||
throws MalformedURLException {
|
||||
return getValidator(new URL(HTTP + host + PATH_SEPARATOR
|
||||
+ VALIDATOR_SERVICE_NAME));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validator service for the given url string
|
||||
*
|
||||
* @param serviceUrl
|
||||
* The url string
|
||||
* @return The validator service for the given url string
|
||||
* @throws MalformedURLException
|
||||
* If errors occur creating the URL object
|
||||
*/
|
||||
public static Validator getValidatorServiceForUrl(final String url)
|
||||
throws MalformedURLException {
|
||||
return getValidator(new URL(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validator service for the given URL
|
||||
*
|
||||
* @param url
|
||||
* The URL
|
||||
* @return The validator service at the given URL
|
||||
*/
|
||||
private static Validator getValidator(URL url) {
|
||||
Validator validator = validatorServiceMap.get(url);
|
||||
if (validator == null) {
|
||||
validator = getPort(url, Validator.class);
|
||||
validatorServiceMap.put(url, validator);
|
||||
}
|
||||
return validator;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Sends a SubmitObjects request to the lifecycle manager service at the
|
||||
* given host
|
||||
*
|
||||
* @param request
|
||||
* The request
|
||||
* @param host
|
||||
* The host to send the request to
|
||||
* @throws RegistryServiceException
|
||||
* If errors occur during request submission
|
||||
*/
|
||||
public static void sendSubmitObjectsRequest(SubmitObjectsRequest request,
|
||||
String host) throws RegistryServiceException {
|
||||
|
||||
LifecycleManager lcm;
|
||||
try {
|
||||
lcm = getLifecycleManagerServiceForHost(host);
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error getting lifecyclemanager for host at [" + host + "]",
|
||||
e);
|
||||
}
|
||||
RegistryResponseType response;
|
||||
try {
|
||||
response = lcm.submitObjects(request);
|
||||
} catch (MsgRegistryException e) {
|
||||
throw new RegistryServiceException(
|
||||
"Error executing submitObjects!", e);
|
||||
}
|
||||
String status = response.getStatus();
|
||||
if (status.equals(RegistryResponseStatus.SUCCESS)) {
|
||||
statusHandler.info("Submit Objects request ["
|
||||
+ response.getRequestId() + "] successful");
|
||||
} else if (status.equals(RegistryResponseStatus.PARTIAL_SUCCESS)) {
|
||||
statusHandler.warn("Submit Objects request ["
|
||||
+ response.getRequestId() + "] partially successful");
|
||||
} else if (status.equals(RegistryResponseStatus.FAILURE)) {
|
||||
statusHandler.error("Submit Objects request ["
|
||||
+ response.getRequestId() + "] failed!");
|
||||
StringBuilder exceptionMessage = new StringBuilder();
|
||||
for (RegistryExceptionType exc : response.getException()) {
|
||||
exceptionMessage.append(exc).append("\n");
|
||||
}
|
||||
throw new RegistryServiceException("Submit Objects Request ["
|
||||
+ response.getRequestId()
|
||||
+ "] failed with the following exceptions:"
|
||||
+ exceptionMessage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SubmitObjectsRequest with the given parameters
|
||||
*/
|
||||
public static SubmitObjectsRequest createSubmitObjectRequest(String id,
|
||||
Mode mode, String comment, boolean checkReferences,
|
||||
RegistryObjectListType objectList, List<SlotType> slots) {
|
||||
SubmitObjectsRequest request = new SubmitObjectsRequest();
|
||||
request.setId(id);
|
||||
request.setMode(mode);
|
||||
request.setRegistryObjectList(objectList);
|
||||
request.setComment(comment);
|
||||
request.setCheckReferences(checkReferences);
|
||||
if (slots != null) {
|
||||
request.getSlot().addAll(slots);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a RemoveObjectsRequest with the given parameters
|
||||
*/
|
||||
public static RemoveObjectsRequest createRemoveObjectsRequest(String id,
|
||||
String comment, boolean deleteChildren, String deletionScope,
|
||||
ObjectRefListType objectRefs, QueryType query,
|
||||
Collection<SlotType> slots) {
|
||||
RemoveObjectsRequest request = new RemoveObjectsRequest();
|
||||
request.setId(id);
|
||||
request.setComment(comment);
|
||||
request.setDeleteChildren(deleteChildren);
|
||||
request.setDeletionScope(deletionScope);
|
||||
request.setObjectRefList(objectRefs);
|
||||
if (query != null) {
|
||||
request.setQuery(query);
|
||||
}
|
||||
if (slots != null) {
|
||||
request.getSlot().addAll(slots);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a QueryRequest with the given parameters
|
||||
*/
|
||||
public static QueryRequest createQueryRequest(String id, String comment,
|
||||
QueryType query, ResponseOptionType responseOption) {
|
||||
QueryRequest request = new QueryRequest();
|
||||
request.setId(id);
|
||||
request.setComment(comment);
|
||||
request.setQuery(query);
|
||||
request.setResponseOption(responseOption);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a QueryType object with the given parameters
|
||||
*/
|
||||
public static QueryType createQueryType(String queryDefinition,
|
||||
List<SlotType> slots) {
|
||||
QueryType query = new QueryType();
|
||||
query.setQueryDefinition(queryDefinition);
|
||||
if (slots != null) {
|
||||
query.getSlot().addAll(slots);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Object> T getPort(URL serviceUrl,
|
||||
Class<?> serviceInterface) {
|
||||
W3CEndpointReferenceBuilder endpointBuilder = new W3CEndpointReferenceBuilder();
|
||||
endpointBuilder.wsdlDocumentLocation(serviceUrl.toString() + WSDL);
|
||||
endpointBuilder.address(serviceUrl.toString());
|
||||
W3CEndpointReference ref = endpointBuilder.build();
|
||||
return (T) ref.getPort(serviceInterface);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* 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.common.registry.services;
|
||||
|
||||
import com.raytheon.uf.common.registry.RegistryException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Exception class used for exceptions communicating with the soap services
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class RegistryServiceException extends RegistryException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7177311901603902063L;
|
||||
|
||||
/**
|
||||
* Creates a new exception with the given message
|
||||
*
|
||||
* @param message
|
||||
* The message to attach to the exception
|
||||
*/
|
||||
public RegistryServiceException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception with the given message and cause
|
||||
*
|
||||
* @param message
|
||||
* The message to attach to the exception
|
||||
* @param cause
|
||||
* The underlying cause of the exception
|
||||
*/
|
||||
public RegistryServiceException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new exception with the given cause
|
||||
*
|
||||
* @param cause
|
||||
* The underlying cause of the exception
|
||||
*/
|
||||
public RegistryServiceException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
|
@ -9,7 +9,8 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0",
|
|||
org.hibernate;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0"
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
org.apache.commons.cxf;bundle-version="1.0.0"
|
||||
Export-Package: com.raytheon.uf.common.registry.schemas.ebxml.util,
|
||||
oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4,
|
||||
oasis.names.tc.ebxml.regrep.xsd.lcm.v4,
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.hibernate.usertype.UserType;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 21, 2012 #184 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Added null check
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -97,6 +98,9 @@ public class XMLGregorianCalendarType implements UserType {
|
|||
throws HibernateException, SQLException {
|
||||
GregorianCalendar cal = new GregorianCalendar();
|
||||
Timestamp date = resultSet.getTimestamp(names[0]);
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
cal.setTimeInMillis(date.getTime());
|
||||
|
||||
try {
|
||||
|
|
|
@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlSeeAlso;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsResponse;
|
||||
|
||||
import org.apache.cxf.annotations.GZIP;
|
||||
|
||||
/**
|
||||
* The Cataloger interface.
|
||||
*
|
||||
|
@ -37,6 +39,7 @@ import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsResponse;
|
|||
* source version: 2.1
|
||||
*
|
||||
*/
|
||||
@GZIP(threshold = 0)
|
||||
@WebService(name = "Cataloger", targetNamespace = "urn:oasis:names:tc:ebxml-regrep:wsdl:spi:interfaces:4.0")
|
||||
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@XmlSeeAlso({ oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
|
||||
|
|
|
@ -32,6 +32,8 @@ import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.UpdateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import org.apache.cxf.annotations.GZIP;
|
||||
|
||||
/**
|
||||
*
|
||||
* The portType for LifecycleManager abstract interface.
|
||||
|
@ -41,6 +43,7 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
|||
* source version: 2.1
|
||||
*
|
||||
*/
|
||||
@GZIP(threshold = 0)
|
||||
@WebService(name = "LifecycleManager", targetNamespace = "urn:oasis:names:tc:ebxml-regrep:wsdl:registry:interfaces:4.0")
|
||||
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@XmlSeeAlso({ oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
|
||||
|
|
|
@ -25,10 +25,13 @@ import javax.jws.WebMethod;
|
|||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
import javax.jws.soap.SOAPBinding;
|
||||
import javax.jws.soap.SOAPBinding.Style;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
|
||||
import org.apache.cxf.annotations.GZIP;
|
||||
|
||||
/**
|
||||
* PortType for a NotificationListener interface
|
||||
*
|
||||
|
@ -36,8 +39,9 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
|||
* source version: 2.1
|
||||
*
|
||||
*/
|
||||
@GZIP(threshold = 0)
|
||||
@WebService(name = "NotificationListener", targetNamespace = "urn:oasis:names:tc:ebxml-regrep:wsdl:NotificationListener:interfaces:4.0")
|
||||
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@SOAPBinding(style = Style.RPC, parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@XmlSeeAlso({ oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
|
||||
oasis.names.tc.ebxml.regrep.xsd.spi.v4.ObjectFactory.class,
|
||||
oasis.names.tc.ebxml.regrep.xsd.lcm.v4.ObjectFactory.class,
|
||||
|
|
|
@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlSeeAlso;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
|
||||
import org.apache.cxf.annotations.GZIP;
|
||||
|
||||
/**
|
||||
*
|
||||
* The portType for QueryManager abstract interface.
|
||||
|
@ -39,6 +41,7 @@ import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
|||
* source version: 2.1
|
||||
*
|
||||
*/
|
||||
@GZIP(threshold = 0)
|
||||
@WebService(name = "QueryManager", targetNamespace = "urn:oasis:names:tc:ebxml-regrep:wsdl:registry:interfaces:4.0")
|
||||
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@XmlSeeAlso({ oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
|
||||
|
|
|
@ -30,6 +30,8 @@ import javax.xml.bind.annotation.XmlSeeAlso;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
|
||||
|
||||
import org.apache.cxf.annotations.GZIP;
|
||||
|
||||
/**
|
||||
* The Validator interface.
|
||||
*
|
||||
|
@ -37,6 +39,7 @@ import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
|
|||
* source version: 2.1
|
||||
*
|
||||
*/
|
||||
@GZIP(threshold = 0)
|
||||
@WebService(name = "Validator", targetNamespace = "urn:oasis:names:tc:ebxml-regrep:wsdl:spi:interfaces:4.0")
|
||||
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
|
||||
@XmlSeeAlso({ oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectFactory.class,
|
||||
|
|
|
@ -22,6 +22,7 @@ package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
@ -38,7 +39,6 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -88,16 +88,12 @@ public class ActionType extends ExtensibleObjectType implements Serializable {
|
|||
@XmlTransient
|
||||
private Integer key;
|
||||
|
||||
@OneToOne
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@XmlElement(name = "AffectedObjects")
|
||||
@DynamicSerializeElement
|
||||
protected RegistryObjectListType affectedObjects;
|
||||
|
||||
@OneToOne
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@OneToOne(cascade = CascadeType.ALL)
|
||||
@XmlElement(name = "AffectedObjectRefs")
|
||||
@DynamicSerializeElement
|
||||
protected ObjectRefListType affectedObjectRefs;
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
|
||||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -37,6 +37,7 @@ import javax.xml.ws.wsaddressing.W3CEndpointReference;
|
|||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -85,10 +86,11 @@ public class DeliveryInfoType extends ExtensibleObjectType {
|
|||
@XmlTransient
|
||||
private Integer key;
|
||||
|
||||
@Transient
|
||||
@XmlElement(name = "NotifyTo", required = true)
|
||||
// TODO: Revisit how to handle serialization of this field
|
||||
// @DynamicSerializeElement
|
||||
@XmlElement(name = "NotifyTo", required = true)
|
||||
@Column(name = "notifyTo", columnDefinition = "text")
|
||||
@Type(type = "com.raytheon.uf.common.registry.schemas.ebxml.util.SerializedType")
|
||||
protected W3CEndpointReference notifyTo;
|
||||
|
||||
@XmlAttribute
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
@ -40,7 +41,6 @@ import javax.xml.bind.annotation.XmlType;
|
|||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -95,8 +95,7 @@ public class MapType implements Serializable {
|
|||
|
||||
@XmlElement(name = "Entry")
|
||||
@DynamicSerializeElement
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE })
|
||||
@ManyToMany
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@JoinTable(schema = "ebxml")
|
||||
protected List<EntryType> entry;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class NotificationType extends RegistryObjectType {
|
|||
|
||||
@XmlElement(name = "Event", required = true)
|
||||
@DynamicSerializeElement
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@ManyToMany(cascade = CascadeType.DETACH)
|
||||
@JoinTable(schema = "ebxml")
|
||||
protected List<AuditableEventType> event;
|
||||
|
||||
|
|
|
@ -21,12 +21,15 @@
|
|||
package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
|
@ -64,10 +67,16 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@XmlType(name = "QueryType")
|
||||
@DynamicSerialize
|
||||
@Entity
|
||||
@Cache(region="registryObjects",usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Cache(region = "registryObjects", usage = CacheConcurrencyStrategy.TRANSACTIONAL)
|
||||
@Table(schema = "ebxml", name = "Query")
|
||||
public class QueryType extends ExtensibleObjectType {
|
||||
|
||||
@Id
|
||||
@SequenceGenerator(name = "QueryTypeGenerator", schema = "ebxml", sequenceName = "ebxml.Query_sequence")
|
||||
@GeneratedValue(generator = "QueryTypeGenerator")
|
||||
@XmlTransient
|
||||
private Integer key;
|
||||
|
||||
@XmlAttribute(required = true)
|
||||
@DynamicSerializeElement
|
||||
protected String queryDefinition;
|
||||
|
@ -93,4 +102,12 @@ public class QueryType extends ExtensibleObjectType {
|
|||
this.queryDefinition = value;
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(Integer key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,8 +89,7 @@ public class RegistryObjectListType implements Serializable {
|
|||
private Integer key;
|
||||
|
||||
@ManyToMany
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.PERSIST })
|
||||
@JoinTable(schema = "ebxml")
|
||||
@XmlElement(name = "RegistryObject")
|
||||
@DynamicSerializeElement
|
||||
|
|
|
@ -123,24 +123,21 @@ public class RegistryObjectType extends IdentifiableType {
|
|||
@XmlElement(name = "Classification")
|
||||
@DynamicSerializeElement
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
org.hibernate.annotations.CascadeType.DETACH,
|
||||
org.hibernate.annotations.CascadeType.MERGE })
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@JoinTable(schema = "ebxml")
|
||||
protected Set<ClassificationType> classification;
|
||||
|
||||
@XmlElement(name = "ExternalIdentifier")
|
||||
@DynamicSerializeElement
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
@JoinTable(schema = "ebxml")
|
||||
protected Set<ExternalIdentifierType> externalIdentifier;
|
||||
|
||||
@XmlElement(name = "ExternalLink")
|
||||
@DynamicSerializeElement
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@ManyToMany(fetch = FetchType.LAZY)
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
|
||||
@JoinTable(schema = "ebxml")
|
||||
protected Set<ExternalLinkType> externalLink;
|
||||
|
||||
|
|
|
@ -27,10 +27,9 @@ import javax.persistence.CascadeType;
|
|||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
|
@ -85,7 +84,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@Table(schema = "ebxml", name = "Subscription")
|
||||
public class SubscriptionType extends RegistryObjectType {
|
||||
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@OneToMany(cascade = CascadeType.ALL)
|
||||
@XmlElement(name = "DeliveryInfo")
|
||||
@DynamicSerializeElement
|
||||
@JoinTable(schema = "ebxml")
|
||||
|
@ -96,7 +95,7 @@ public class SubscriptionType extends RegistryObjectType {
|
|||
@DynamicSerializeElement
|
||||
protected QueryType selector;
|
||||
|
||||
@Column
|
||||
@Column(columnDefinition = "timestamp without timezone default now()")
|
||||
@Type(type = "com.raytheon.uf.common.registry.schemas.ebxml.util.XMLGregorianCalendarType")
|
||||
@XmlAttribute
|
||||
@XmlSchemaType(name = "dateTime")
|
||||
|
@ -110,9 +109,9 @@ public class SubscriptionType extends RegistryObjectType {
|
|||
@DynamicSerializeElement
|
||||
protected XMLGregorianCalendar endTime;
|
||||
|
||||
@Transient
|
||||
@XmlAttribute
|
||||
@DynamicSerializeElement
|
||||
@Type(type = "com.raytheon.uf.common.registry.schemas.ebxml.util.DurationType")
|
||||
protected Duration notificationInterval;
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,6 +23,7 @@ package oasis.names.tc.ebxml.regrep.xsd.rim.v4;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
|
@ -35,8 +36,6 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import org.hibernate.annotations.Cascade;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
|
@ -75,9 +74,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
|
||||
public abstract class TaxonomyElementType extends RegistryObjectType {
|
||||
|
||||
@ManyToMany
|
||||
@Cascade(value = { org.hibernate.annotations.CascadeType.SAVE_UPDATE,
|
||||
org.hibernate.annotations.CascadeType.DETACH })
|
||||
@ManyToMany(cascade = CascadeType.ALL)
|
||||
@XmlElement(name = "ClassificationNode")
|
||||
@DynamicSerializeElement
|
||||
@JoinTable(schema = "ebxml")
|
||||
|
|
|
@ -25,8 +25,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
@ -58,6 +56,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|||
* Feb 07, 2013 1543 djohnson Initial creation
|
||||
* 3/18/2013 1802 bphillip Added additional database functions. Enforcing mandatory transaction propogation
|
||||
* 3/27/2013 1802 bphillip Changed transaction propagation of query methods
|
||||
* 4/9/2013 1802 bphillip Modified how arguments are passed in to query methods
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -114,9 +113,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
*/
|
||||
@Override
|
||||
public void persistAll(final Collection<ENTITY> objs) {
|
||||
for (ENTITY obj : objs) {
|
||||
createOrUpdate(obj);
|
||||
}
|
||||
template.saveOrUpdateAll(objs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,41 +151,11 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public List<ENTITY> getAll() {
|
||||
return query("from " + getEntityClass().getSimpleName(),
|
||||
Collections.<String, Object> emptyMap());
|
||||
return query("from " + getEntityClass().getSimpleName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal convenience method for querying.
|
||||
*
|
||||
* @param queryString
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
protected List<ENTITY> query(String queryString, Map<String, Object> params) {
|
||||
return query(queryString, params, 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
protected List<ENTITY> query(String queryString,
|
||||
Map<String, Object> params, int maxResults) {
|
||||
final int numberOfParams = params.size();
|
||||
String[] paramNames = new String[numberOfParams];
|
||||
Object[] paramValues = new Object[numberOfParams];
|
||||
Iterator<Map.Entry<String, Object>> iter = params.entrySet().iterator();
|
||||
for (int i = 0; i < numberOfParams; i++) {
|
||||
final Entry<String, Object> entry = iter.next();
|
||||
paramNames[i] = entry.getKey();
|
||||
paramValues[i] = entry.getValue();
|
||||
}
|
||||
HibernateTemplate templateToUse = (maxResults == 0) ? template
|
||||
: new HibernateTemplate(this.getSessionFactory());
|
||||
templateToUse.setMaxResults(maxResults);
|
||||
return templateToUse.findByNamedParam(queryString, paramNames,
|
||||
paramValues);
|
||||
|
||||
public ENTITY uniqueResult(String queryString) {
|
||||
return uniqueResult(queryString, new Object[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -199,8 +166,8 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
* @return
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
protected ENTITY uniqueResult(String queryString, Map<String, Object> params) {
|
||||
final List<ENTITY> results = query(queryString, params);
|
||||
protected ENTITY uniqueResult(String queryString, Object... params) {
|
||||
final List<ENTITY> results = executeHQLQuery(queryString, params);
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
} else if (results.size() > 1) {
|
||||
|
@ -210,6 +177,29 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
return results.get(0);
|
||||
}
|
||||
|
||||
public List<ENTITY> query(String queryString) {
|
||||
return executeHQLQuery(queryString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal convenience method for querying.
|
||||
*
|
||||
* @param queryString
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public List<ENTITY> query(String queryString, Object... params) {
|
||||
return executeHQLQuery(queryString, 0, params);
|
||||
}
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public List<ENTITY> query(String queryString, int maxResults,
|
||||
Object... params) {
|
||||
return executeHQLQuery(queryString, maxResults, params);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an HQL query in a new Hibernate session
|
||||
*
|
||||
|
@ -222,26 +212,8 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
* If errors are encountered during the HQL query
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public <T extends Object> List<T> executeHQLQuery(String queryString)
|
||||
throws DataAccessLayerException {
|
||||
return executeHQLQuery(queryString, true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an HQL query
|
||||
*
|
||||
* @param <T>
|
||||
* The return object type
|
||||
* @param queryString
|
||||
* A StringBuilder instance containing an HQL query to execute
|
||||
* @return List containing the results of the query
|
||||
* @throws DataAccessLayerException
|
||||
* If Hibernate errors occur during execution of the query
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public List<ENTITY> executeHQLQuery(StringBuilder queryString)
|
||||
throws DataAccessLayerException {
|
||||
return executeHQLQuery(queryString.toString(), true, null);
|
||||
public <T extends Object> List<T> executeHQLQuery(String queryString) {
|
||||
return executeHQLQuery(queryString, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -262,45 +234,67 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
* If Hibernate errors occur during the execution of the query
|
||||
*/
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public List<ENTITY> executeHQLQuery(String queryString,
|
||||
Map<String, Object> params) throws DataAccessLayerException {
|
||||
return executeHQLQuery(queryString, true, params);
|
||||
public <T extends Object> List<T> executeHQLQuery(String queryString,
|
||||
Object... params) {
|
||||
return executeHQLQuery(queryString, 0, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an HQL query in an existing Hibernate session
|
||||
* Executes a named parameter query with the option to limit the maximum
|
||||
* number of results. The params argument contains the parameter names in
|
||||
* alternating fashion. The parameter name comes first followed by the
|
||||
* parameter value.
|
||||
* <p>
|
||||
* For example, to execute this query 'SELECT obj.field FROM object obj
|
||||
* WHERE obj.id=:id' you would call: <br>
|
||||
* executeHQLQuery("SELECT obj.field FROM object obj WHERE obj.id=:id", 0,
|
||||
* ":id",idValue)
|
||||
*
|
||||
* @param <T>
|
||||
* An object type to query for
|
||||
* @param queryString
|
||||
* The query to execute
|
||||
* @param session
|
||||
* The existing Hibernate session
|
||||
* @return The results of the HQL query
|
||||
* @throws DataAccessLayerException
|
||||
* if errors are encountered during the HQL query
|
||||
* The query string, possibly containg name parameters
|
||||
* @param maxResults
|
||||
* The maximum number of results to return
|
||||
* @param params
|
||||
* The named parameter pairs
|
||||
* @return The results of the query
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public <T extends Object> List<T> executeHQLQuery(final String queryString,
|
||||
boolean eager, final Map<String, Object> params)
|
||||
throws DataAccessLayerException {
|
||||
try {
|
||||
Query query = getSessionFactory().getCurrentSession()
|
||||
.createQuery(queryString).setCacheable(true)
|
||||
.setCacheRegion(QUERY_CACHE_REGION);
|
||||
if (params != null) {
|
||||
for (String name : params.keySet()) {
|
||||
Object val = params.get(name);
|
||||
query.setParameter(name, val);
|
||||
}
|
||||
}
|
||||
List<T> results = query.list();
|
||||
return results;
|
||||
} catch (Throwable e) {
|
||||
throw new DataAccessLayerException("Error executing HQLQuery ["
|
||||
+ queryString + "]", e);
|
||||
int maxResults, Object... params) {
|
||||
if (params.length % 2 != 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Wrong number of arguments submitted to executeHQLQuery.");
|
||||
}
|
||||
HibernateTemplate templateToUse = (maxResults == 0) ? template
|
||||
: new HibernateTemplate(this.getSessionFactory());
|
||||
templateToUse.setMaxResults(maxResults);
|
||||
templateToUse.setQueryCacheRegion(QUERY_CACHE_REGION);
|
||||
if (params.length == 0) {
|
||||
return templateToUse.find(queryString);
|
||||
}
|
||||
String[] paramNames = new String[params.length / 2];
|
||||
Object[] paramValues = new Object[params.length / 2];
|
||||
int index = 0;
|
||||
for (int i = 0; i < params.length; i += 2) {
|
||||
paramNames[index] = (String) params[i];
|
||||
paramValues[index] = params[i + 1];
|
||||
index++;
|
||||
}
|
||||
return templateToUse.findByNamedParam(queryString, paramNames,
|
||||
paramValues);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public <T extends Object> Iterator<T> getQueryIterator(
|
||||
final String queryString, Object... params) {
|
||||
if (params.length == 0) {
|
||||
return template.iterate(queryString);
|
||||
}
|
||||
return template.iterate(queryString, params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -316,7 +310,7 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
*/
|
||||
public int executeHQLStatement(String queryString)
|
||||
throws DataAccessLayerException {
|
||||
return executeHQLStatement(queryString, true, null);
|
||||
return executeHQLStatement(queryString, new Object[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,60 +326,41 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
*/
|
||||
public int executeHQLStatement(StringBuilder queryString)
|
||||
throws DataAccessLayerException {
|
||||
return executeHQLStatement(queryString.toString(), true, null);
|
||||
return executeHQLStatement(queryString.toString(), new Object[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an HQL query with a map of name value pairs with which to
|
||||
* substitute into the query. This method is a convenience method for
|
||||
* executing prepared statements
|
||||
*
|
||||
* @param <T>
|
||||
* The return object type
|
||||
* @param queryString
|
||||
* The prepared HQL query to execute. This query contains values
|
||||
* that will be substituted according to the names and values
|
||||
* found in the params map
|
||||
* @param params
|
||||
* The named parameters to substitute into the HQL query
|
||||
* @return List containing the results of the query
|
||||
* @throws DataAccessLayerException
|
||||
* If Hibernate errors occur during the execution of the query
|
||||
*/
|
||||
public int executeHQLStatement(String queryString,
|
||||
Map<String, Object> params) throws DataAccessLayerException {
|
||||
return executeHQLStatement(queryString, true, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes an HQL query in an existing Hibernate session
|
||||
* Executes a named parameter statement(non-query). The params argument
|
||||
* contains the parameter names in alternating fashion. The parameter name
|
||||
* comes first followed by the parameter value.
|
||||
*
|
||||
* @param <T>
|
||||
* An object type to query for
|
||||
* @param queryString
|
||||
* The query to execute
|
||||
* @param session
|
||||
* The existing Hibernate session
|
||||
* @return The results of the HQL query
|
||||
* @throws DataAccessLayerException
|
||||
* if errors are encountered during the HQL query
|
||||
* The query string, possibly containg name parameters
|
||||
* @param maxResults
|
||||
* The maximum number of results to return
|
||||
* @param params
|
||||
* The named parameter pairs
|
||||
* @return The results of the query
|
||||
*/
|
||||
public int executeHQLStatement(final String queryString, boolean eager,
|
||||
final Map<String, Object> params) throws DataAccessLayerException {
|
||||
public int executeHQLStatement(final String statement, Object... params)
|
||||
throws DataAccessLayerException {
|
||||
if (params.length % 2 != 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Wrong number of arguments submitted to executeHQLStatement.");
|
||||
}
|
||||
try {
|
||||
Query query = getSessionFactory().getCurrentSession()
|
||||
.createQuery(queryString).setCacheable(true)
|
||||
.createQuery(statement).setCacheable(true)
|
||||
.setCacheRegion(QUERY_CACHE_REGION);
|
||||
if (params != null) {
|
||||
for (String name : params.keySet()) {
|
||||
Object val = params.get(name);
|
||||
query.setParameter(name, val);
|
||||
}
|
||||
for (int i = 0; i < params.length; i += 2) {
|
||||
query.setParameter((String) params[i], params[i + 1]);
|
||||
}
|
||||
return query.executeUpdate();
|
||||
} catch (Throwable e) {
|
||||
throw new DataAccessLayerException(
|
||||
"Error executing HQL Statement [" + queryString + "]", e);
|
||||
"Error executing HQL Statement [" + statement + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,23 +379,11 @@ public abstract class SessionManagedDao<IDENTIFIER extends Serializable, ENTITY
|
|||
@SuppressWarnings("unchecked")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public <T extends Object> List<T> executeCriteriaQuery(
|
||||
final DetachedCriteria criteria) throws DataAccessLayerException {
|
||||
final DetachedCriteria criteria) {
|
||||
if (criteria == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
try {
|
||||
List<T> results = null;
|
||||
results = criteria
|
||||
.getExecutableCriteria(
|
||||
getSessionFactory().getCurrentSession())
|
||||
.setCacheable(true).setCacheRegion(QUERY_CACHE_REGION)
|
||||
.list();
|
||||
return results;
|
||||
} catch (Throwable e) {
|
||||
throw new DataAccessLayerException(
|
||||
"Error executing Criteria Query", e);
|
||||
}
|
||||
return template.findByCriteria(criteria);
|
||||
}
|
||||
|
||||
public void evict(ENTITY entity) {
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
||||
import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
||||
|
@ -38,6 +36,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1543 djohnson Initial creation
|
||||
* Feb 22, 2013 1543 djohnson Made public as YAJSW doesn't like Spring exceptions.
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -45,7 +44,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthDataSetUpdate;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class BandwidthDataSetUpdateDao extends
|
||||
SessionManagedDao<Long, BandwidthDataSetUpdate> implements IBandwidthDataSetUpdateDao {
|
||||
SessionManagedDao<Long, BandwidthDataSetUpdate> implements
|
||||
IBandwidthDataSetUpdateDao {
|
||||
|
||||
private static final String GET_DATASETMETADATA_BY_PROVIDER_AND_DATASET = "from BandwidthDataSetUpdate d where "
|
||||
+ "d.providerName = :providerName and "
|
||||
|
@ -71,10 +71,8 @@ public class BandwidthDataSetUpdateDao extends
|
|||
@Override
|
||||
public List<BandwidthDataSetUpdate> getByProviderDataSet(
|
||||
String providerName, String dataSetName) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("providerName", providerName);
|
||||
params.put("dataSetName", dataSetName);
|
||||
return query(GET_DATASETMETADATA_BY_PROVIDER_AND_DATASET, params);
|
||||
return query(GET_DATASETMETADATA_BY_PROVIDER_AND_DATASET,
|
||||
"providerName", providerName, "dataSetName", dataSetName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,13 +81,10 @@ public class BandwidthDataSetUpdateDao extends
|
|||
@Override
|
||||
public List<BandwidthDataSetUpdate> getByProviderDataSetReferenceTime(
|
||||
String providerName, String dataSetName, Calendar baseReferenceTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("providerName", providerName);
|
||||
params.put("dataSetName", dataSetName);
|
||||
params.put("dataSetBaseTime", baseReferenceTime);
|
||||
return query(
|
||||
GET_DATASETMETADATA_BY_PROVIDER_AND_DATASET_AND_BASEREFERENCETIME,
|
||||
params);
|
||||
"providerName", providerName, "dataSetName", dataSetName,
|
||||
"dataSetBaseTime", baseReferenceTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
||||
|
@ -39,6 +37,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.BandwidthSubscription;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 07, 2013 1543 djohnson Initial creation
|
||||
* Feb 22, 2013 1543 djohnson Made public as YAJSW doesn't like Spring exceptions.
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -87,12 +86,10 @@ public class BandwidthSubscriptionDao extends
|
|||
@Override
|
||||
public BandwidthSubscription getByRegistryIdReferenceTime(
|
||||
String registryId, Calendar baseReferenceTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("registryId", registryId);
|
||||
params.put("baseReferenceTime", baseReferenceTime);
|
||||
return uniqueResult(
|
||||
GET_SUBSCRIPTIONDAO_BY_REGISTRY_ID_AND_BASEREFERENCETIME,
|
||||
params);
|
||||
"registryId", registryId, "baseReferenceTime",
|
||||
baseReferenceTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,12 +98,10 @@ public class BandwidthSubscriptionDao extends
|
|||
@Override
|
||||
public List<BandwidthSubscription> getBySubscription(
|
||||
Subscription subscription) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("owner", subscription.getOwner());
|
||||
params.put("provider", subscription.getProvider());
|
||||
params.put("name", subscription.getName());
|
||||
params.put("dataSetName", subscription.getDataSetName());
|
||||
return query(GET_SUBSCRIPTIONDAO_BY_SUBSCRIPTION, params);
|
||||
return query(GET_SUBSCRIPTIONDAO_BY_SUBSCRIPTION, "owner",
|
||||
subscription.getOwner(), "provider",
|
||||
subscription.getProvider(), "name", subscription.getName(),
|
||||
"dataSetName", subscription.getDataSetName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,9 +109,8 @@ public class BandwidthSubscriptionDao extends
|
|||
*/
|
||||
@Override
|
||||
public List<BandwidthSubscription> getByRegistryId(String registryId) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("registryId", registryId);
|
||||
return query(GET_SUBSCRIPTIONDAO_BY_REGISTRYID, params);
|
||||
return query(GET_SUBSCRIPTIONDAO_BY_REGISTRYID, "registryId",
|
||||
registryId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,12 +119,9 @@ public class BandwidthSubscriptionDao extends
|
|||
@Override
|
||||
public List<BandwidthSubscription> getByProviderDataSetReferenceTime(
|
||||
String provider, String dataSetName, Calendar baseReferenceTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("provider", provider);
|
||||
params.put("dataSetName", dataSetName);
|
||||
params.put("baseReferenceTime", baseReferenceTime);
|
||||
return query(
|
||||
GET_SUBSCRIPTIONDAO_BY_PROVIDER_AND_DATASET_AND_BASEREFERENCETIME,
|
||||
params);
|
||||
"provider", provider, "dataSetName", dataSetName,
|
||||
"baseReferenceTime", baseReferenceTime);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Network;
|
||||
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
||||
|
@ -40,6 +38,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1543 djohnson Initial creation
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,7 +46,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.retrieval.RetrievalStatus;
|
|||
* @version 1.0
|
||||
*/
|
||||
abstract class BaseBandwidthAllocationDao<ENTITY extends BandwidthAllocation>
|
||||
extends SessionManagedDao<Long, ENTITY> implements IBaseBandwidthAllocationDao<ENTITY> {
|
||||
extends SessionManagedDao<Long, ENTITY> implements
|
||||
IBaseBandwidthAllocationDao<ENTITY> {
|
||||
|
||||
private static final String GET_BANDWIDTH_ALLOCATIONS_BY_SUBSCRIPTION_ID = "from %s res where res.bandwidthSubscription.id = :subscriptionId";
|
||||
|
||||
|
@ -56,8 +56,7 @@ abstract class BaseBandwidthAllocationDao<ENTITY extends BandwidthAllocation>
|
|||
private static final String GET_BANDWIDTH_ALLOCATIONS_BY_STATE = "from %s res where res.status = :state";
|
||||
|
||||
private static final String GET_DEFERRED = "from %s alloc where "
|
||||
+ "alloc.status = :status and "
|
||||
+ "alloc.network = :network and "
|
||||
+ "alloc.status = :status and " + "alloc.network = :network and "
|
||||
+ "alloc.endTime <= :endTime";
|
||||
|
||||
/**
|
||||
|
@ -65,11 +64,9 @@ abstract class BaseBandwidthAllocationDao<ENTITY extends BandwidthAllocation>
|
|||
*/
|
||||
@Override
|
||||
public List<ENTITY> getBySubscriptionId(Long subscriptionId) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("subscriptionId", subscriptionId);
|
||||
return query(String.format(
|
||||
GET_BANDWIDTH_ALLOCATIONS_BY_SUBSCRIPTION_ID, getEntityClass()
|
||||
.getSimpleName()), params);
|
||||
.getSimpleName()), "subscriptionId", subscriptionId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,10 +74,8 @@ abstract class BaseBandwidthAllocationDao<ENTITY extends BandwidthAllocation>
|
|||
*/
|
||||
@Override
|
||||
public List<ENTITY> getByNetwork(Network network) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("network", network);
|
||||
return query(String.format(GET_BANDWIDTH_ALLOCATIONS_BY_NETWORK,
|
||||
getEntityClass().getSimpleName()), params);
|
||||
getEntityClass().getSimpleName()), "network", network);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,24 +83,18 @@ abstract class BaseBandwidthAllocationDao<ENTITY extends BandwidthAllocation>
|
|||
*/
|
||||
@Override
|
||||
public List<ENTITY> getByState(RetrievalStatus state) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("state", state);
|
||||
return query(String.format(GET_BANDWIDTH_ALLOCATIONS_BY_STATE,
|
||||
getEntityClass().getSimpleName()), params);
|
||||
getEntityClass().getSimpleName()), "state", state);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<ENTITY> getDeferred(Network network,
|
||||
Calendar endTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("status", RetrievalStatus.DEFERRED);
|
||||
params.put("network", network);
|
||||
params.put("endTime", endTime);
|
||||
public List<ENTITY> getDeferred(Network network, Calendar endTime) {
|
||||
return query(
|
||||
String.format(GET_DEFERRED, getEntityClass().getSimpleName()),
|
||||
params);
|
||||
"status", RetrievalStatus.DEFERRED, "network", network,
|
||||
"endTime", endTime);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
package com.raytheon.uf.edex.datadelivery.bandwidth.hibernate;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.jdbc.Work;
|
||||
|
||||
|
@ -39,6 +37,7 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2013 1543 djohnson Initial creation
|
||||
* Feb 22, 2013 1543 djohnson Made public as YAJSW doesn't like Spring exceptions.
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,7 +45,8 @@ import com.raytheon.uf.edex.datadelivery.bandwidth.dao.SubscriptionRetrieval;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class SubscriptionRetrievalDao extends
|
||||
BaseBandwidthAllocationDao<SubscriptionRetrieval> implements ISubscriptionRetrievalDao {
|
||||
BaseBandwidthAllocationDao<SubscriptionRetrieval> implements
|
||||
ISubscriptionRetrievalDao {
|
||||
|
||||
private static final String GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_BASE = "from SubscriptionRetrieval sr where "
|
||||
+ " sr.bandwidthSubscription.id in ("
|
||||
|
@ -74,25 +74,20 @@ public class SubscriptionRetrievalDao extends
|
|||
@Override
|
||||
public List<SubscriptionRetrieval> getByProviderDataSetReferenceTime(
|
||||
String provider, String dataSetName, Calendar baseReferenceTime) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("provider", provider);
|
||||
params.put("dataSetName", dataSetName);
|
||||
params.put("baseReferenceTime", baseReferenceTime);
|
||||
return query(
|
||||
GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET_AND_BASEREFERENCETIME,
|
||||
params);
|
||||
"provider", provider, "dataSetName", dataSetName,
|
||||
"baseReferenceTime", baseReferenceTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public List<SubscriptionRetrieval> getByProviderDataSet(
|
||||
String provider, String dataSetName) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("provider", provider);
|
||||
params.put("dataSetName", dataSetName);
|
||||
return query(GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET, params);
|
||||
public List<SubscriptionRetrieval> getByProviderDataSet(String provider,
|
||||
String dataSetName) {
|
||||
return query(GET_SUBSCRIPTIONRETRIEVAL_BY_PROVIDER_AND_DATASET,
|
||||
"provider", provider, "dataSetName", dataSetName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package com.raytheon.uf.edex.datadelivery.event.notification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
|
@ -21,6 +20,7 @@ import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2012 jsanchez Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transactional boundaries and spring injection of daos
|
||||
* 4/9/2013 1802 bphillip Changed to use new query method signatures in SessionManagedDao
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,7 +52,6 @@ public class NotificationDao extends
|
|||
*/
|
||||
public List<NotificationRecord> lookupNotifications(String username,
|
||||
Integer hours, Integer maxResults) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
String hql = "from NotificationRecord rec";
|
||||
String nameClause = " rec.username=:userName ";
|
||||
String dateClause = " rec.date >= :date ";
|
||||
|
@ -62,23 +61,29 @@ public class NotificationDao extends
|
|||
latestTime.add(Calendar.HOUR, -hours);
|
||||
}
|
||||
|
||||
List<Object> params = new ArrayList<Object>();
|
||||
if (username == null && hours != null) {
|
||||
hql += " where " + dateClause;
|
||||
params.put("date", latestTime);
|
||||
params.add("date");
|
||||
params.add(latestTime);
|
||||
} else if (username != null && hours == null) {
|
||||
hql += " where " + nameClause;
|
||||
params.put("userName", username);
|
||||
params.add("userName");
|
||||
params.add(username);
|
||||
} else if (username != null && hours != null) {
|
||||
hql += " where " + nameClause + " and " + dateClause;
|
||||
params.put("date", latestTime);
|
||||
params.put("userName", username);
|
||||
params.add("date");
|
||||
params.add(latestTime);
|
||||
params.add("userName");
|
||||
params.add(username);
|
||||
}
|
||||
hql += " order by rec.date desc";
|
||||
|
||||
if (maxResults == null) {
|
||||
return this.query(hql, params);
|
||||
return this.query(hql, params.toArray(new Object[params.size()]));
|
||||
} else {
|
||||
return this.query(hql, params, maxResults);
|
||||
return this.query(hql, maxResults,
|
||||
params.toArray(new Object[params.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,10 +97,8 @@ public class NotificationDao extends
|
|||
*/
|
||||
public int purgeExpiredData(Calendar expiration)
|
||||
throws DataAccessLayerException {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("date", expiration);
|
||||
String hqlStatement = "delete NotificationRecord r where r.date < :date";
|
||||
return this.executeHQLStatement(hqlStatement, params);
|
||||
return this.executeHQLStatement(hqlStatement, "date", expiration);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,10 +109,8 @@ public class NotificationDao extends
|
|||
* @return the number of rows deleted
|
||||
*/
|
||||
public int deleteRecords(List<Integer> ids) throws DataAccessLayerException {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("ids", ids);
|
||||
String hqlStatement = "delete NotificationRecord r where r.id in :ids";
|
||||
return this.executeHQLStatement(hqlStatement, params);
|
||||
return this.executeHQLStatement(hqlStatement, "ids", ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -121,4 +121,11 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.datadelivery.registry"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -31,7 +31,23 @@ Require-Bundle: com.raytheon.uf.common.registry.schemas.ebxml;bundle-version="1.
|
|||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
uk.ltd.getahead;bundle-version="1.0.0"
|
||||
Export-Package: com.raytheon.uf.edex.registry.ebxml.init,
|
||||
uk.ltd.getahead;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.datadelivery.request;bundle-version="1.0.0"
|
||||
Export-Package: com.raytheon.uf.edex.registry.ebxml.acp,
|
||||
com.raytheon.uf.edex.registry.ebxml.audittrail,
|
||||
com.raytheon.uf.edex.registry.ebxml.dao,
|
||||
com.raytheon.uf.edex.registry.ebxml.exception,
|
||||
com.raytheon.uf.edex.registry.ebxml.init,
|
||||
com.raytheon.uf.edex.registry.ebxml.services,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.cataloger,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.lifecycle,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query
|
||||
com.raytheon.uf.edex.registry.ebxml.services.notification,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query.adhoc,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query.types,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query.types.canonical,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.query.types.ext,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.validator,
|
||||
com.raytheon.uf.edex.registry.ebxml.services.validator.types,
|
||||
com.raytheon.uf.edex.registry.ebxml.util,
|
||||
com.raytheon.uf.edex.registry.ebxml.web
|
||||
|
|
|
@ -4,24 +4,29 @@
|
|||
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- <bean id="metadataSessionFactory" class="org.hibernate.impl.SessionFactoryImpl" /> -->
|
||||
<!-- <bean id="metadataSessionFactory" class="org.hibernate.impl.SessionFactoryImpl"
|
||||
/> -->
|
||||
<!-- QUERY -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="queryServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl" >
|
||||
<property name="queryTypeMgr" ref="queryTypeManager"/>
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl">
|
||||
<property name="queryTypeMgr" ref="queryTypeManager" />
|
||||
</bean>
|
||||
|
||||
|
||||
<bean id="queryServiceSoapImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl" >
|
||||
<property name="eagerFetch" value="true"/>
|
||||
<property name="queryTypeMgr" ref="queryTypeManager"/>
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl">
|
||||
<property name="eagerFetch" value="true" />
|
||||
<property name="queryTypeMgr" ref="queryTypeManager" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- NOTIFICATION LISTENER -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="notificationServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerImpl" />
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.NotificationListenerImpl">
|
||||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="classificationNodeDao" ref="classificationNodeDao"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- LIFE CYCLE MANAGER -->
|
||||
|
@ -30,9 +35,9 @@
|
|||
class="com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
<property name="validator" ref="validatorServiceImpl" />
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
<property name="auditTrailMgr" ref="auditTrailManager"/>
|
||||
<property name="cataloger" ref="catalogerServiceImpl"/>
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
<property name="auditableEventDao" ref="AuditableEventTypeDao" />
|
||||
<property name="cataloger" ref="catalogerServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<!-- VALIDATOR -->
|
||||
|
@ -46,22 +51,24 @@
|
|||
<!-- CATALOGER -->
|
||||
<!-- Define concrete implementation of the service -->
|
||||
<bean id="catalogerServiceImpl"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.cataloger.CatalogerImpl" >
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.cataloger.CatalogerImpl">
|
||||
<property name="registryObjectDao" ref="registryObjectDao" />
|
||||
</bean>
|
||||
|
||||
<bean id="edexRegistryManager" class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager" >
|
||||
<property name="xacmlPep" ref="XACMLPolicyEnforcementPoint"/>
|
||||
<property name="queryManager" ref="queryServiceImpl"/>
|
||||
|
||||
<bean id="edexRegistryManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.util.EDEXRegistryManager">
|
||||
<property name="xacmlPep" ref="XACMLPolicyEnforcementPoint" />
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryHandler"
|
||||
class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
|
||||
<property name="lcmFactory" ref="edexRegistryManager" />
|
||||
<property name="queryFactory" ref="edexRegistryManager" />
|
||||
</bean>
|
||||
|
||||
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
|
||||
<constructor-arg ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
<bean id="registryHandler" class="com.raytheon.uf.common.registry.ebxml.FactoryRegistryHandler">
|
||||
<property name="lcmFactory" ref="edexRegistryManager"/>
|
||||
<property name="queryFactory" ref="edexRegistryManager"/>
|
||||
</bean>
|
||||
|
||||
<bean name="registryManagerInstanceInitializer" class="com.raytheon.uf.common.registry.RegistryManager">
|
||||
<constructor-arg ref="registryHandler" />
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean name="RegistryNotificationManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.RegistryNotificationManager" />
|
||||
|
||||
<bean name="RegistrySubscriptionManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.services.notification.RegistrySubscriptionManager">
|
||||
<property name="queryManager" ref="queryServiceImpl" />
|
||||
<property name="subscriptionDao" ref="subscriptionTypeDao" />
|
||||
<property name="auditableEventDao" ref="AuditableEventTypeDao" />
|
||||
<property name="notificationManager" ref="RegistryNotificationManager" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="ebxml-notification" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
|
||||
<endpoint id="processSubscriptions"
|
||||
uri="clusteredquartz://ebxml/processSubscriptions/?cron=0/10 * * * * ?" />
|
||||
|
||||
<route id="sendRegistryNotifications">
|
||||
<from uri="processSubscriptions" />
|
||||
<bean ref="RegistrySubscriptionManager" method="processSubscriptions" />
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
|
||||
</beans>
|
|
@ -1,5 +1,5 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
|
@ -65,4 +65,8 @@
|
|||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="associationDao" ref="associationDao" />
|
||||
</bean>
|
||||
|
||||
<bean name="notificationTypeDao" class="com.raytheon.uf.edex.registry.ebxml.dao.NotificationTypeDao" >
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
</bean>
|
||||
</beans>
|
|
@ -10,12 +10,7 @@
|
|||
<bean id="DbInit" class="com.raytheon.uf.edex.registry.ebxml.dao.DbInit">
|
||||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
<property name="sessionFactory" ref="metadataSessionFactory" />
|
||||
<property name="xacmlAdmin" ref="XACMLPolicyAdministrator"/>
|
||||
</bean>
|
||||
|
||||
<bean id="auditTrailManager"
|
||||
class="com.raytheon.uf.edex.registry.ebxml.audittrail.AuditTrailManager">
|
||||
<property name="dao" ref="registryObjectDao" />
|
||||
<property name="xacmlAdmin" ref="XACMLPolicyAdministrator" />
|
||||
</bean>
|
||||
|
||||
<bean id="pwCallback"
|
||||
|
@ -51,24 +46,18 @@
|
|||
<property name="lcm" ref="lcmServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<bean id="queryServiceUrl" factory-bean="ServiceUrlFactory"
|
||||
factory-method="getServiceAddress">
|
||||
<constructor-arg type="java.lang.String">
|
||||
<value>query</value>
|
||||
</constructor-arg>
|
||||
<constructor-arg type="java.lang.String">
|
||||
<value>${EBXML_QUERY_SERVICE_SOAP_PORT}</value>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<!-- start service -->
|
||||
<bean id="queryServiceFactory" class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
|
||||
init-method="create">
|
||||
<property name="serviceClass"
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager" /> <!-- Interface... -->
|
||||
<property name="address"
|
||||
value="http://0.0.0.0:${EBXML_QUERY_SERVICE_SOAP_PORT}/query" />
|
||||
<property name="serviceBean" ref="queryServiceSoapImpl" /> <!-- Reference concrete implementation -->
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager" />
|
||||
<property name="address">
|
||||
<bean factory-bean="ServiceUrlFactory" factory-method="getServiceAddress">
|
||||
<constructor-arg value="queryManager" />
|
||||
<constructor-arg value="${EBXML_QUERY_SERVICE_SOAP_PORT}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="serviceBean" ref="queryServiceSoapImpl" />
|
||||
<property name="inInterceptors">
|
||||
<list>
|
||||
<ref bean="XACMLPolicyEnforcementPoint" />
|
||||
|
@ -80,20 +69,28 @@
|
|||
<bean id="notificationServiceFactory" class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
|
||||
init-method="create">
|
||||
<property name="serviceClass"
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener" /> <!-- Interface... -->
|
||||
<property name="address"
|
||||
value="http://0.0.0.0:${EBXML_QUERY_SERVICE_SOAP_PORT}/notificationListener" />
|
||||
<property name="serviceBean" ref="notificationServiceImpl" /> <!-- Reference concrete implementation -->
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener" />
|
||||
<property name="address">
|
||||
<bean factory-bean="ServiceUrlFactory" factory-method="getServiceAddress">
|
||||
<constructor-arg value="notificationListener" />
|
||||
<constructor-arg value="${EBXML_QUERY_SERVICE_SOAP_PORT}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="serviceBean" ref="notificationServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<!-- start service -->
|
||||
<bean id="lcmServiceFactory" class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
|
||||
init-method="create">
|
||||
<property name="serviceClass"
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager" /> <!-- Interface... -->
|
||||
<property name="address"
|
||||
value="http://0.0.0.0:${EBXML_QUERY_SERVICE_SOAP_PORT}/lcm" />
|
||||
<property name="serviceBean" ref="lcmServiceImpl" /> <!-- Reference concrete implementation -->
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager" />
|
||||
<property name="address">
|
||||
<bean factory-bean="ServiceUrlFactory" factory-method="getServiceAddress">
|
||||
<constructor-arg value="lifecycleManager" />
|
||||
<constructor-arg value="${EBXML_QUERY_SERVICE_SOAP_PORT}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="serviceBean" ref="lcmServiceImpl" />
|
||||
<property name="inInterceptors">
|
||||
<list>
|
||||
<ref bean="XACMLPolicyEnforcementPoint" />
|
||||
|
@ -105,29 +102,27 @@
|
|||
<bean id="validatorServiceFactory" class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
|
||||
init-method="create">
|
||||
<property name="serviceClass"
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Validator" /> <!-- Interface... -->
|
||||
<property name="address"
|
||||
value="http://0.0.0.0:${EBXML_QUERY_SERVICE_SOAP_PORT}/validator" />
|
||||
<property name="serviceBean" ref="validatorServiceImpl" /> <!-- Reference concrete implementation -->
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Validator" />
|
||||
<property name="address">
|
||||
<bean factory-bean="ServiceUrlFactory" factory-method="getServiceAddress">
|
||||
<constructor-arg value="validator" />
|
||||
<constructor-arg value="${EBXML_QUERY_SERVICE_SOAP_PORT}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="serviceBean" ref="validatorServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<!-- start service -->
|
||||
<bean id="catalogerServiceFactory" class="org.apache.cxf.jaxws.JaxWsServerFactoryBean"
|
||||
init-method="create">
|
||||
<property name="serviceClass"
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Cataloger" /> <!-- Interface... -->
|
||||
<property name="address"
|
||||
value="http://0.0.0.0:${EBXML_QUERY_SERVICE_SOAP_PORT}/getServiceAddress" />
|
||||
<property name="serviceBean" ref="catalogerServiceImpl" /> <!-- Reference concrete implementation -->
|
||||
value="oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Cataloger" />
|
||||
<property name="address">
|
||||
<bean factory-bean="ServiceUrlFactory" factory-method="getServiceAddress">
|
||||
<constructor-arg value="cataloger" />
|
||||
<constructor-arg value="${EBXML_QUERY_SERVICE_SOAP_PORT}" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="serviceBean" ref="catalogerServiceImpl" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="regRep" xmlns="http://camel.apache.org/schema/spring">
|
||||
<route id="internalSubmit">
|
||||
<from uri="vm:submitRegistryObjects?concurrentConsumers=2" />
|
||||
<bean ref="lcmServiceImpl" method="submitObjectsInternal" />
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -56,6 +56,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.raytheon.uf.common.registry.IRegistryRequest;
|
||||
import com.raytheon.uf.common.registry.IRegistryRequest.Action;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -66,7 +68,6 @@ import com.raytheon.uf.edex.registry.acp.xacml.exception.XACMLException;
|
|||
import com.raytheon.uf.edex.registry.acp.xacml.exception.XACMLNotApplicableException;
|
||||
import com.raytheon.uf.edex.registry.acp.xacml.exception.XACMLProcessingException;
|
||||
import com.raytheon.uf.edex.registry.acp.xacml.util.XACMLObjectUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl;
|
||||
|
@ -88,6 +89,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* 8/17/2012 724 bphillip Initial Coding
|
||||
* Oct 01, 2012 1187 djohnson Commented out code throwing {@link ClassCastException}s.
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Added additional object checking
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -175,10 +177,15 @@ public class XACMLContextHandler {
|
|||
ResourceType resource = new ResourceTypeImplBuilder().buildObject();
|
||||
addIdToResource(resource, obj.getId());
|
||||
addAttributeToResource(resource, "owner", obj.getOwner());
|
||||
addAttributeToResource(resource, "name", obj.getName()
|
||||
.getLocalizedString().get(0).getValue());
|
||||
addAttributeToResource(resource, "description", obj
|
||||
.getDescription().getLocalizedString().get(0).getValue());
|
||||
if (!obj.getName().getLocalizedString().isEmpty()) {
|
||||
addAttributeToResource(resource, "name", obj.getName()
|
||||
.getLocalizedString().get(0).getValue());
|
||||
}
|
||||
if (!obj.getDescription().getLocalizedString().isEmpty()) {
|
||||
addAttributeToResource(resource, "description", obj
|
||||
.getDescription().getLocalizedString().get(0)
|
||||
.getValue());
|
||||
}
|
||||
addAttributeToResource(resource, "status", obj.getStatus());
|
||||
addAttributeToResource(resource, "objectType", obj.getObjectType());
|
||||
}
|
||||
|
@ -296,6 +303,7 @@ public class XACMLContextHandler {
|
|||
|
||||
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
|
||||
.createResponseOptionType();
|
||||
responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(responseOption,
|
||||
query);
|
||||
if (queryResponse.getStatus().equals(RegistryResponseStatus.SUCCESS)
|
||||
|
|
|
@ -41,12 +41,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.constants.StatusTypes;
|
||||
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.acp.xacml.util.XACMLParser;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.StatusTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.ExtrinsicObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl;
|
||||
|
@ -64,6 +64,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 8/17/2012 724 bphillip Initial Coding
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Import changes due to moved constant classes
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
|
|
@ -1,185 +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.audittrail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.StatusTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class used for submitting auditable events.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 28, 2012 #363 bphillip Initial creation
|
||||
* 8/3/2012 724 bphillip Modified to use predefined constants
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AuditTrailManager {
|
||||
|
||||
/** The data access object used for manipulating registry objects */
|
||||
private RegistryObjectTypeDao<RegistryObjectType> dao;
|
||||
|
||||
/**
|
||||
* Creates an audit trail entry from a RegistryResponseType
|
||||
*
|
||||
* @param response
|
||||
* The RegistryResponseType object from which to get the
|
||||
* auditable information
|
||||
* @param actionType
|
||||
* The action taken on the objects referenced by the response
|
||||
* object
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur while querying or submitting the auditable
|
||||
* event
|
||||
*/
|
||||
public void createAuditTrailFromResponse(RegistryResponseType response,
|
||||
String actionType) throws EbxmlRegistryException {
|
||||
ObjectRefListType refList = response.getObjectRefList();
|
||||
RegistryObjectListType regObjList = response.getRegistryObjectList();
|
||||
|
||||
List<RegistryObjectType> objs = new ArrayList<RegistryObjectType>();
|
||||
if (refList != null) {
|
||||
List<String> objIds = new ArrayList<String>();
|
||||
for (ObjectRefType ref : refList.getObjectRef()) {
|
||||
objIds.add(ref.getId());
|
||||
}
|
||||
objs.addAll(dao.getById(objIds));
|
||||
}
|
||||
|
||||
if (regObjList != null) {
|
||||
objs.addAll(regObjList.getRegistryObject());
|
||||
}
|
||||
createAuditTrail(objs, actionType, response.getRequestId(),
|
||||
System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an audit trail entry from a list of registry objects
|
||||
*
|
||||
* @param objs
|
||||
* The list of objects to generate an audit trail for
|
||||
* @param actionType
|
||||
* The action taken on the objects in the registry object list
|
||||
* @param requestId
|
||||
* The requestId of the request which modified the objects in the
|
||||
* registry object list
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during the submission of the audit trail
|
||||
* entry
|
||||
*/
|
||||
public void createAuditTrail(List<RegistryObjectType> objs,
|
||||
String actionType, String requestId) throws EbxmlRegistryException {
|
||||
createAuditTrail(objs, actionType, requestId,
|
||||
System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an audit trail entry from a list of registry objects
|
||||
*
|
||||
* @param objs
|
||||
* The list of objects to generate an audit trail for
|
||||
* @param actionType
|
||||
* The action taken on the objects in the registry object list
|
||||
* @param requestId
|
||||
* The requestId of the request which modified the objects in the
|
||||
* registry object list
|
||||
* @param time
|
||||
* The time at which the modifications to the registry objects
|
||||
* occurred
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during the submission of the audit trail
|
||||
* entry
|
||||
*/
|
||||
public void createAuditTrail(List<RegistryObjectType> objs,
|
||||
String actionType, String requestId, long time)
|
||||
throws EbxmlRegistryException {
|
||||
List<RegistryObjectType> objsToRemove = new ArrayList<RegistryObjectType>();
|
||||
for (RegistryObjectType obj : objs) {
|
||||
if (obj instanceof AuditableEventType) {
|
||||
objsToRemove.add(obj);
|
||||
}
|
||||
}
|
||||
objs.removeAll(objsToRemove);
|
||||
if (objs.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
AuditableEventType event = EbxmlObjectUtil.rimObjectFactory
|
||||
.createAuditableEventType();
|
||||
|
||||
event.setId(EbxmlObjectUtil.getUUID());
|
||||
event.setLid(EbxmlObjectUtil.getUUID());
|
||||
event.setOwner(objs.get(0).getOwner());
|
||||
event.setObjectType(RegistryObjectTypes.AUDITABLE_EVENT);
|
||||
ActionType action = EbxmlObjectUtil.rimObjectFactory.createActionType();
|
||||
action.setAffectedObjects(EbxmlObjectUtil
|
||||
.createRegistryObjectList(objs));
|
||||
action.setEventType(actionType);
|
||||
event.getAction().add(action);
|
||||
event.setRequestId(requestId);
|
||||
try {
|
||||
event.setTimestamp(EbxmlObjectUtil.getTime(time));
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error creating timestamp for auditable event", e);
|
||||
}
|
||||
event.setUser("Client");
|
||||
event.setStatus(StatusTypes.APPROVED);
|
||||
event.setVersionInfo(new VersionInfoType());
|
||||
dao.create(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data access object
|
||||
*
|
||||
* @param dao
|
||||
* The data access object to set
|
||||
*/
|
||||
public void setDao(RegistryObjectTypeDao<RegistryObjectType> dao) {
|
||||
this.dao = dao;
|
||||
}
|
||||
|
||||
}
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +37,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/30/2012 724 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,15 +57,9 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getByTargetAndType(String target, String type)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.targetObject='"
|
||||
+ target + "' and obj.type='" + type + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error getting by target and type", e);
|
||||
}
|
||||
public List<AssociationType> getByTargetAndType(String target, String type) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.targetObject='"
|
||||
+ target + "' and obj.type='" + type + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,14 +73,9 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getBySourceAndType(String source, String type)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ source + "' and obj.type='" + type + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<AssociationType> getBySourceAndType(String source, String type) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ source + "' and obj.type='" + type + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,16 +92,12 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getBySourceTargetAndType(String source,
|
||||
String target, String type) throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ source
|
||||
+ "' and obj.type='"
|
||||
+ type
|
||||
+ "' and obj.targetObject='" + target + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
String target, String type) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ source
|
||||
+ "' and obj.type='"
|
||||
+ type
|
||||
+ "' and obj.targetObject='" + target + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,17 +109,12 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getAllAssociations(String objReferenced)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ objReferenced
|
||||
+ "' or obj.targetObject='"
|
||||
+ objReferenced
|
||||
+ "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<AssociationType> getAllAssociations(String objReferenced) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ objReferenced
|
||||
+ "' or obj.targetObject='"
|
||||
+ objReferenced
|
||||
+ "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,14 +126,9 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getAssociationsTo(String objReferenced)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.targetObject='"
|
||||
+ objReferenced + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<AssociationType> getAssociationsTo(String objReferenced) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.targetObject='"
|
||||
+ objReferenced + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,14 +140,9 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<AssociationType> getAssociationsFrom(String objReferenced)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ objReferenced + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<AssociationType> getAssociationsFrom(String objReferenced) {
|
||||
return executeHQLQuery("from AssociationType obj where obj.sourceObject='"
|
||||
+ objReferenced + "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,8 +153,7 @@ public class AssociationDao extends RegistryObjectTypeDao<AssociationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public void deleteAssociationsForObj(String objReferenced)
|
||||
throws EbxmlRegistryException {
|
||||
public void deleteAssociationsForObj(String objReferenced) {
|
||||
List<AssociationType> associations = getAllAssociations(objReferenced);
|
||||
if (!associations.isEmpty()) {
|
||||
for (AssociationType association : associations) {
|
||||
|
|
|
@ -20,13 +20,29 @@
|
|||
|
||||
package com.raytheon.uf.edex.registry.ebxml.dao;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryRequestType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.common.registry.constants.ActionTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.constants.StatusTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -38,6 +54,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/18/2013 1802 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,30 +64,227 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
public class AuditableEventTypeDao extends
|
||||
RegistryObjectTypeDao<AuditableEventType> {
|
||||
|
||||
private static final String IDS = ":ids";
|
||||
|
||||
/**
|
||||
* Query to find events of interest when sending registry replication
|
||||
* notifications
|
||||
*/
|
||||
private static final String EVENTS_OF_INTEREST_QUERY = "select event from AuditableEventType as event "
|
||||
+ "inner join event.action as action "
|
||||
+ "inner join action.affectedObjects as AffectedObjects "
|
||||
+ "inner join AffectedObjects.registryObject as RegistryObjects "
|
||||
+ "where (RegistryObjects.id in (:ids) OR action.eventType = ?) and event.timestamp >= ?";
|
||||
|
||||
/** Optional end time clause */
|
||||
private static final String END_TIME_CLAUSE = " and event.timestamp <= ?";
|
||||
|
||||
/** Order by clause */
|
||||
private static final String ORDER_CLAUSE = " order by event.timestamp asc";
|
||||
|
||||
public void create(AuditableEventType event) {
|
||||
template.save(event);
|
||||
// Notify the subscription monitor that a new event has occurred
|
||||
try {
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(
|
||||
"vm:processSubscriptions", null);
|
||||
} catch (Throwable t) {
|
||||
statusHandler
|
||||
.error("Unexpected error ecountered while processing subscriptions!",
|
||||
t);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get events of interest for registry subscriptions
|
||||
*
|
||||
* @param objectsOfInterest
|
||||
* @return
|
||||
* @return @
|
||||
*/
|
||||
public Iterator<AuditableEventType> getEventsOfInterest(
|
||||
SubscriptionType subscription, List<ObjectRefType> objectsOfInterest) {
|
||||
if (objectsOfInterest.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (ObjectRefType objOfInterest : objectsOfInterest) {
|
||||
buf.append(", '").append(objOfInterest.getId()).append("'");
|
||||
}
|
||||
String inString = buf.toString().replaceFirst(",", "");
|
||||
Iterator<AuditableEventType> eventIterator = null;
|
||||
if (subscription.getEndTime() == null) {
|
||||
eventIterator = this.getQueryIterator(
|
||||
(EVENTS_OF_INTEREST_QUERY + ORDER_CLAUSE).replace(IDS,
|
||||
inString), ActionTypes.delete, subscription
|
||||
.getStartTime());
|
||||
} else {
|
||||
eventIterator = this.getQueryIterator((EVENTS_OF_INTEREST_QUERY
|
||||
+ END_TIME_CLAUSE + ORDER_CLAUSE).replace(IDS, inString),
|
||||
ActionTypes.delete, subscription.getStartTime(),
|
||||
subscription.getEndTime());
|
||||
}
|
||||
return eventIterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the date that the auditable event was sent to a particular host
|
||||
*
|
||||
* @param auditableEvents
|
||||
* The events to add the last sent date
|
||||
* @param subscription
|
||||
* The subscription that this auditable event is being used
|
||||
* @param deliveryAddress
|
||||
* The delivery address @ * If errors occur while adding the slot
|
||||
* to the auditable event
|
||||
*/
|
||||
public void addSendDate(List<AuditableEventType> auditableEvents,
|
||||
SubscriptionType subscription, String deliveryAddress) {
|
||||
for (AuditableEventType auditableEvent : auditableEvents) {
|
||||
EbxmlObjectUtil.addStringSlot(auditableEvent, subscription.getId()
|
||||
+ deliveryAddress,
|
||||
String.valueOf(System.currentTimeMillis()), false);
|
||||
this.createOrUpdate(auditableEvent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the date that the auditable event was sent to a delivery address, if
|
||||
* any
|
||||
*
|
||||
* @param auditableEvent
|
||||
* The auditable event to check
|
||||
* @param subscription
|
||||
* The subscription that this auditable event pertains to
|
||||
* @param deliveryAddress
|
||||
* The delivery address to check
|
||||
* @return The last sent date in millis
|
||||
*/
|
||||
public Long getSendDate(AuditableEventType auditableEvent,
|
||||
SubscriptionType subscription, String deliveryAddress) {
|
||||
String sendDate = EbxmlObjectUtil.getStringSlotValue(auditableEvent,
|
||||
subscription.getId() + deliveryAddress);
|
||||
if (sendDate == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Long.parseLong(sendDate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an auditable event from a registry request and object references
|
||||
*
|
||||
* @param request
|
||||
* The request that generated the events
|
||||
* @param actionMap
|
||||
* The actions that occurred
|
||||
* @param currentTime
|
||||
* The time the event occurred @ * If errors occur while creating
|
||||
* the event
|
||||
* @throws EbxmlRegistryException
|
||||
*/
|
||||
public List<AuditableEventType> getEventsOfInterest(
|
||||
List<RegistryObjectType> objectsOfInterest)
|
||||
public void createAuditableEventsFromRefs(RegistryRequestType request,
|
||||
Map<String, List<ObjectRefType>> actionMap, long currentTime)
|
||||
throws EbxmlRegistryException {
|
||||
String query = "from AuditableEventType event inner join event.action as action inner join action.affectedObjects as AffectedObjects inner join AffectedObjects.registryObject as RegistryObjects where RegistryObjects.id = '";
|
||||
for (int i = 0; i < objectsOfInterest.size(); i++) {
|
||||
query += "'" + objectsOfInterest.get(i).getId() + "'";
|
||||
if (i != objectsOfInterest.size() - 1) {
|
||||
query += ",";
|
||||
}
|
||||
AuditableEventType event = createEvent(request, currentTime);
|
||||
for (String actionType : actionMap.keySet()) {
|
||||
event.getAction().add(
|
||||
createAuditableEventAction(actionMap.get(actionType), null,
|
||||
actionType));
|
||||
}
|
||||
query += "'";
|
||||
create(event);
|
||||
}
|
||||
|
||||
try {
|
||||
return this.executeHQLQuery(query);
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
/**
|
||||
* Creates an auditable event from a registry request and registry objects
|
||||
*
|
||||
* @param request
|
||||
* The request that generated the events
|
||||
* @param actionMap
|
||||
* The actions that occurred
|
||||
* @param currentTime
|
||||
* The time the event occurred @ * If errors occur while creating
|
||||
* the event
|
||||
* @throws EbxmlRegistryException
|
||||
*/
|
||||
public void createAuditableEventsFromObjects(RegistryRequestType request,
|
||||
Map<String, List<RegistryObjectType>> actionMap, long currentTime)
|
||||
throws EbxmlRegistryException {
|
||||
AuditableEventType event = createEvent(request, currentTime);
|
||||
for (String actionType : actionMap.keySet()) {
|
||||
event.getAction().add(
|
||||
createAuditableEventAction(null, actionMap.get(actionType),
|
||||
actionType));
|
||||
}
|
||||
create(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper class to create and action for the AuditableEventType
|
||||
*
|
||||
* @param affectedObjectRefs
|
||||
* The references to any affected objects
|
||||
* @param affectedObjects
|
||||
* The affected objects
|
||||
* @param actionType
|
||||
* The action that occurred
|
||||
* @return The ActionType object
|
||||
*/
|
||||
private ActionType createAuditableEventAction(
|
||||
List<ObjectRefType> affectedObjectRefs,
|
||||
List<RegistryObjectType> affectedObjects, String actionType) {
|
||||
ActionType action = new ActionType();
|
||||
action.setEventType(actionType);
|
||||
if (affectedObjectRefs != null) {
|
||||
ObjectRefListType refList = new ObjectRefListType();
|
||||
refList.getObjectRef().addAll(affectedObjectRefs);
|
||||
action.setAffectedObjectRefs(refList);
|
||||
}
|
||||
if (affectedObjects != null) {
|
||||
RegistryObjectListType regObjList = new RegistryObjectListType();
|
||||
regObjList.getRegistryObject().addAll(affectedObjects);
|
||||
action.setAffectedObjects(regObjList);
|
||||
}
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates and Auditable event from a request
|
||||
*
|
||||
* @param request
|
||||
* The request that generated the event
|
||||
* @param currentTime
|
||||
* The time of the event
|
||||
* @return The AuditableEventType object
|
||||
* @throws EbxmlRegistryException
|
||||
* @ * If errors occur while creating the event
|
||||
*/
|
||||
private AuditableEventType createEvent(RegistryRequestType request,
|
||||
long currentTime) throws EbxmlRegistryException {
|
||||
AuditableEventType event = EbxmlObjectUtil.rimObjectFactory
|
||||
.createAuditableEventType();
|
||||
event.setId(EbxmlObjectUtil.getUUID());
|
||||
event.setLid(EbxmlObjectUtil.getUUID());
|
||||
event.setOwner(RegistryUtil.DEFAULT_OWNER);
|
||||
event.setObjectType(RegistryObjectTypes.AUDITABLE_EVENT);
|
||||
event.setRequestId(request.getId());
|
||||
try {
|
||||
event.setTimestamp(EbxmlObjectUtil
|
||||
.getTimeAsXMLGregorianCalendar(currentTime));
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error creating timestamp for auditable event", e);
|
||||
}
|
||||
event.setUser("Client");
|
||||
event.setStatus(StatusTypes.APPROVED);
|
||||
event.setVersionInfo(new VersionInfoType());
|
||||
String notificationFrom = EbxmlObjectUtil.getStringSlotValue(request,
|
||||
EbxmlObjectUtil.HOME_SLOT_NAME);
|
||||
if (notificationFrom != null) {
|
||||
EbxmlObjectUtil.addStringSlot(event,
|
||||
EbxmlObjectUtil.HOME_SLOT_NAME, notificationFrom, false);
|
||||
}
|
||||
return event;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,9 +23,6 @@ import java.util.List;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
* Data access object for retrieving ClassificationNodeTypes
|
||||
*
|
||||
|
@ -38,6 +35,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* 2/21/2012 184 bphillip Initial creation
|
||||
* 8/3/2012 724 bphillip Added more methods for getting classification nodes
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,25 +58,25 @@ public class ClassificationNodeDao extends
|
|||
|
||||
}
|
||||
|
||||
public boolean isValidNode(String id) {
|
||||
long result = (Long) this
|
||||
.executeHQLQuery(
|
||||
"select count(node) from ClassificationNodeType node where node.id=:id",
|
||||
"id", id).get(0);
|
||||
return result != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves ClassificationNode objects based on the path
|
||||
*
|
||||
* @param path
|
||||
* The path to get the classification node type for
|
||||
* @return The ClassificationNode object with the specified path
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during the query
|
||||
*/
|
||||
public ClassificationNodeType getByPath(String path)
|
||||
throws EbxmlRegistryException {
|
||||
List<ClassificationNodeType> result;
|
||||
try {
|
||||
result = this
|
||||
.executeHQLQuery("select obj from ClassificationNodeType obj where obj.path='"
|
||||
+ path + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public ClassificationNodeType getByPath(String path) {
|
||||
List<ClassificationNodeType> result = this
|
||||
.executeHQLQuery("select obj from ClassificationNodeType obj where obj.path='"
|
||||
+ path + "'");
|
||||
if (result.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -92,18 +90,11 @@ public class ClassificationNodeDao extends
|
|||
* @param code
|
||||
* The code of the classification node
|
||||
* @return The ID of the classification node with the given code
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public String getNodeFromCode(String code) throws EbxmlRegistryException {
|
||||
List<String> results;
|
||||
try {
|
||||
results = this
|
||||
.executeHQLQuery("select obj.id from ClassificationNodeType obj where obj.code='"
|
||||
+ code + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public String getNodeFromCode(String code) {
|
||||
List<String> results = this
|
||||
.executeHQLQuery("select obj.id from ClassificationNodeType obj where obj.code='"
|
||||
+ code + "'");
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
|
@ -118,18 +109,11 @@ public class ClassificationNodeDao extends
|
|||
* @param id
|
||||
* The object ID of the classification node
|
||||
* @return The code of the classification node with the given ID
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public String getCodeFromNode(String id) throws EbxmlRegistryException {
|
||||
List<String> results;
|
||||
try {
|
||||
results = this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.id='"
|
||||
+ id + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public String getCodeFromNode(String id) {
|
||||
List<String> results = this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.id='"
|
||||
+ id + "'");
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
|
@ -142,51 +126,37 @@ public class ClassificationNodeDao extends
|
|||
* Gets the codes of the telephone types in the registry
|
||||
*
|
||||
* @return The codes of the telephone types in the registry
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<String> getTelephoneTypes() throws EbxmlRegistryException {
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ TELEPHONE_TYPE_REGEX + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<String> getTelephoneTypes() {
|
||||
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ TELEPHONE_TYPE_REGEX + "'");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the codes of the address types in the registry
|
||||
*
|
||||
* @return The codes of the address types in the registry
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<String> getAddressTypes() throws EbxmlRegistryException {
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ ADDRESS_TYPE_REGEX + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<String> getAddressTypes() {
|
||||
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ ADDRESS_TYPE_REGEX + "'");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the codes of the email types in the registry
|
||||
*
|
||||
* @return The codes dmail types in the registry
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<String> getEmailTypes() throws EbxmlRegistryException {
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ EMAIL_TYPE_REGEX + "'");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<String> getEmailTypes() {
|
||||
return this
|
||||
.executeHQLQuery("select obj.code from ClassificationNodeType obj where obj.lid like '"
|
||||
+ EMAIL_TYPE_REGEX + "'");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,6 +76,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerIm
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/9/2012 184 bphillip Initial Coding
|
||||
* 3/18/2013 1082 bphillip Changed to use transactional boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Changed submitObjects method call from submitObjectsInternal
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -364,7 +365,7 @@ public class DbInit implements ApplicationListener {
|
|||
"Error assigning default owner", e);
|
||||
}
|
||||
}
|
||||
lcm.submitObjectsInternal(obj);
|
||||
lcm.submitObjects(obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,13 +22,10 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
|||
package com.raytheon.uf.edex.registry.ebxml.dao;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.IdentifiableType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.dao.SessionManagedDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
||||
|
@ -43,6 +40,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/18/2013 1082 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -88,12 +86,8 @@ public abstract class IdentifiableTypeDao<ENTITY extends IdentifiableType>
|
|||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getById(List<String> ids) throws EbxmlRegistryException {
|
||||
try {
|
||||
return this.executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
this.getEntityClass(), QueryConstants.ID, "in", ids));
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
this.getEntityClass(), QueryConstants.ID, "in", ids));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -107,16 +101,10 @@ public abstract class IdentifiableTypeDao<ENTITY extends IdentifiableType>
|
|||
* If errors occur during the query
|
||||
*/
|
||||
public List<String> getMatchingIds(String id) throws EbxmlRegistryException {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("id", id);
|
||||
String hql = "select obj.id from "
|
||||
+ this.getEntityClass().getSimpleName()
|
||||
+ " obj where obj.id like :id";
|
||||
try {
|
||||
return this.executeHQLQuery(hql, false, params);
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeHQLQuery(hql, "id", id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* 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.dao;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Data access object for accessing registry notifications
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
*/
|
||||
public class NotificationTypeDao extends
|
||||
RegistryObjectTypeDao<NotificationType> {
|
||||
|
||||
@Override
|
||||
protected Class<NotificationType> getEntityClass() {
|
||||
return NotificationType.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -25,8 +25,7 @@ import java.util.List;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.OrganizationType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
|
@ -40,6 +39,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/30/2012 724 bphillip Initial creation
|
||||
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,13 +65,8 @@ public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<OrganizationType> getAllOrganizations()
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from OrganizationType");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<OrganizationType> getAllOrganizations() {
|
||||
return getAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,17 +79,11 @@ public class OrganizationDao extends RegistryObjectTypeDao<OrganizationType> {
|
|||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<OrganizationType> getOrganizationByName(String name)
|
||||
throws EbxmlRegistryException {
|
||||
List<OrganizationType> orgs;
|
||||
try {
|
||||
orgs = executeHQLQuery("select obj from OrganizationType obj inner join obj.name.localizedString as theName where lower(obj.id) like '%"
|
||||
+ name.toLowerCase()
|
||||
+ "%' or lower(theName.value) like '%"
|
||||
+ name.toLowerCase() + "%' order by obj.id asc");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<OrganizationType> getOrganizationByName(String name) {
|
||||
List<OrganizationType> orgs = executeHQLQuery("select obj from OrganizationType obj inner join obj.name.localizedString as theName where lower(obj.id) like '%"
|
||||
+ name.toLowerCase()
|
||||
+ "%' or lower(theName.value) like '%"
|
||||
+ name.toLowerCase() + "%' order by obj.id asc");
|
||||
return orgs;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ import java.util.List;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.PersonType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
|
@ -41,6 +40,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/30/2012 724 bphillip Initial creation
|
||||
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,22 +64,16 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @param firstName
|
||||
* The first name
|
||||
* @return The matching users
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<PersonType> getByFirstName(String firstName)
|
||||
throws EbxmlRegistryException {
|
||||
public List<PersonType> getByFirstName(String firstName) {
|
||||
if (firstName == null || firstName.trim().isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%"
|
||||
+ firstName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%"
|
||||
+ firstName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,22 +83,16 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @param lastName
|
||||
* The last name
|
||||
* @return The matching users
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<PersonType> getByLastName(String lastName)
|
||||
throws EbxmlRegistryException {
|
||||
public List<PersonType> getByLastName(String lastName) {
|
||||
if (lastName == null || lastName.trim().isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.lastName) like '%"
|
||||
+ lastName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.lastName) like '%"
|
||||
+ lastName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,33 +104,24 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @param lastName
|
||||
* The last name
|
||||
* @return The matching users
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<PersonType> getByFirstAndLastName(String firstName,
|
||||
String lastName) throws EbxmlRegistryException {
|
||||
String lastName) {
|
||||
if (firstName.trim().isEmpty() && lastName.trim().isEmpty()) {
|
||||
try {
|
||||
return this.executeHQLQuery("from PersonType");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeHQLQuery("from PersonType");
|
||||
}
|
||||
if (firstName == null || firstName.trim().isEmpty()) {
|
||||
return getByLastName(lastName);
|
||||
} else if (lastName == null || lastName.trim().isEmpty()) {
|
||||
return getByFirstName(firstName);
|
||||
}
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%"
|
||||
+ firstName.toLowerCase()
|
||||
+ "%' and lower(obj.personName.lastName) like '%"
|
||||
+ lastName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this
|
||||
.executeHQLQuery("select obj from PersonType obj where lower(obj.personName.firstName) like '%"
|
||||
+ firstName.toLowerCase()
|
||||
+ "%' and lower(obj.personName.lastName) like '%"
|
||||
+ lastName.toLowerCase()
|
||||
+ "%' order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,11 +130,8 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @param orgId
|
||||
* The organization ID
|
||||
* @return The users associated with the organization
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<PersonType> getEmployeesOfOrganization(String orgId)
|
||||
throws EbxmlRegistryException {
|
||||
public List<PersonType> getEmployeesOfOrganization(String orgId) {
|
||||
List<PersonType> employees = new ArrayList<PersonType>();
|
||||
List<AssociationType> associations = associationDao.getByTargetAndType(
|
||||
orgId, AssociationTypes.EMPLOYEE_OF);
|
||||
|
@ -172,25 +148,18 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @return List of object arrays (List<Object[]>) Each object array contains
|
||||
* the id, first name, and last name for each PersonType object in
|
||||
* the registry
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public Object getAllUserNames() throws EbxmlRegistryException {
|
||||
try {
|
||||
return this
|
||||
.executeHQLQuery("select obj.id, obj.personName.firstName, obj.personName.lastName from PersonType obj "
|
||||
+ "order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this
|
||||
.executeHQLQuery("select obj.id, obj.personName.firstName, obj.personName.lastName from PersonType obj "
|
||||
+ "order by obj.personName.lastName asc, obj.personName.firstName asc");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all PersonType objects in the registry
|
||||
*
|
||||
* @return All personType objects in the registry
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public List<PersonType> getAllUsers() throws EbxmlRegistryException {
|
||||
return getByFirstAndLastName("", "");
|
||||
|
@ -202,10 +171,8 @@ public class PersonDao extends RegistryObjectTypeDao<PersonType> {
|
|||
* @param userId
|
||||
* The ID of the person
|
||||
* @return The person with the given ID
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during interaction with the database
|
||||
*/
|
||||
public PersonType getByUserId(String userId) throws EbxmlRegistryException {
|
||||
public PersonType getByUserId(String userId) {
|
||||
return this.getById(userId);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.List;
|
|||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
|
@ -36,6 +35,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/13/2013 1082 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,13 +57,8 @@ public class RegistryObjectDao extends
|
|||
* @throws EbxmlRegistryException
|
||||
* If the HQL query fails
|
||||
*/
|
||||
public List<RegistryObjectType> getAllRegistryObjects()
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery("from" + RegistryObjectType.class.getName());
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<RegistryObjectType> getAllRegistryObjects() {
|
||||
return getAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.hibernate.criterion.Projections;
|
|||
import org.hibernate.criterion.Property;
|
||||
import org.springframework.orm.hibernate3.HibernateTemplate;
|
||||
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
||||
|
||||
|
@ -47,6 +46,7 @@ import com.raytheon.uf.edex.registry.ebxml.services.query.QueryConstants;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 19, 2012 184 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Removed exception catching. Added merge method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,6 +63,20 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
public RegistryObjectTypeDao() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges the state of the new object onto the persistent object
|
||||
*
|
||||
* @param newObject
|
||||
* The object to get the state from
|
||||
* @param existingObject
|
||||
* The existing persistent object to copy the state on to
|
||||
*/
|
||||
public void merge(RegistryObjectType newObject,
|
||||
RegistryObjectType existingObject) {
|
||||
newObject.setId(existingObject.getId());
|
||||
template.merge(newObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries for all lids of registry objects matching the pattern of the
|
||||
* given id. A query using 'like' will be executed.
|
||||
|
@ -70,21 +84,14 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param lid
|
||||
* The lid containing % or _ denoting wildcard characters
|
||||
* @return List of lids matching the given id pattern
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur during the query
|
||||
*/
|
||||
public List<String> getMatchingLids(String lid)
|
||||
throws EbxmlRegistryException {
|
||||
public List<String> getMatchingLids(String lid) {
|
||||
DetachedCriteria criteria = DetachedCriteria.forClass(this
|
||||
.getEntityClass());
|
||||
criteria = criteria.add(Property.forName(QueryConstants.LID).like(lid));
|
||||
criteria = criteria.setProjection(Projections
|
||||
.property(QueryConstants.LID));
|
||||
try {
|
||||
return this.executeCriteriaQuery(criteria);
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeCriteriaQuery(criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -95,20 +102,13 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param lids
|
||||
* The list of lids to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByLid(List<String> lids)
|
||||
throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByLid(List<String> lids) {
|
||||
StringBuilder str = new StringBuilder();
|
||||
HqlQueryUtil.assembleSingleParamQuery(str, getEntityClass(),
|
||||
QueryConstants.LID, "in", lids);
|
||||
str.append(" order by obj.lid asc,obj.versionInfo.versionName desc");
|
||||
try {
|
||||
return executeHQLQuery(str.toString());
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return executeHQLQuery(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,10 +119,8 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param lids
|
||||
* The list of lids to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByLid(String... lids) throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByLid(String... lids) {
|
||||
return getByLid(Arrays.asList(lids));
|
||||
}
|
||||
|
||||
|
@ -134,18 +132,10 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param objTypes
|
||||
* The list of objectTypes to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByObjectType(List<String> objTypes)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.OBJECT_TYPE, "in",
|
||||
objTypes));
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<ENTITY> getByObjectType(List<String> objTypes) {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.OBJECT_TYPE, "in", objTypes));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,17 +146,10 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param status
|
||||
* The list of statuses to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByStatus(List<String> status)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.STATUS, "in", status));
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<ENTITY> getByStatus(List<String> status) {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.STATUS, "in", status));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,17 +160,10 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param owner
|
||||
* The list of owners to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByOwner(List<String> owner)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.OWNER, "in", owner));
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
public List<ENTITY> getByOwner(List<String> owner) {
|
||||
return executeHQLQuery(HqlQueryUtil.assembleSingleParamQuery(
|
||||
getEntityClass(), QueryConstants.OWNER, "in", owner));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -198,11 +174,8 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param owner
|
||||
* The list of owners to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByOwner(String... owner)
|
||||
throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByOwner(String... owner) {
|
||||
return getByOwner(Arrays.asList(owner));
|
||||
}
|
||||
|
||||
|
@ -214,19 +187,12 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param ids
|
||||
* The list of names to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the criteria query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByName(List<String> names)
|
||||
throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByName(List<String> names) {
|
||||
StringBuilder str = new StringBuilder(
|
||||
"select obj from RegistryObjectType obj inner join obj.name.localizedString as Strings where Strings.value in ");
|
||||
HqlQueryUtil.assembleInClause(str, "Strings.value", names);
|
||||
try {
|
||||
return this.executeHQLQuery(str.toString());
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeHQLQuery(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -237,19 +203,12 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param ids
|
||||
* The list of descriptions to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the criteria query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByDescription(List<String> descriptions)
|
||||
throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByDescription(List<String> descriptions) {
|
||||
StringBuilder str = new StringBuilder(
|
||||
"select obj from RegistryObjectType obj inner join obj.description.localizedString as Strings where Strings.value in ");
|
||||
HqlQueryUtil.assembleInClause(str, "Strings.value", descriptions);
|
||||
try {
|
||||
return this.executeHQLQuery(str.toString());
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
return this.executeHQLQuery(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,20 +219,14 @@ public abstract class RegistryObjectTypeDao<ENTITY extends RegistryObjectType>
|
|||
* @param ids
|
||||
* The list of classificationNodes to query for
|
||||
* @return The list of registry objects;
|
||||
* @throws EbxmlRegistryException
|
||||
* If the criteria query encounters errors
|
||||
*/
|
||||
public List<ENTITY> getByClassification(List<String> classifications)
|
||||
throws EbxmlRegistryException {
|
||||
public List<ENTITY> getByClassification(List<String> classifications) {
|
||||
StringBuilder str = new StringBuilder(
|
||||
"select obj from RegistryObjectType obj inner join obj.classification as Classifications where ");
|
||||
HqlQueryUtil.assembleInClause(str,
|
||||
"Classifications.classificationNode", classifications);
|
||||
try {
|
||||
return this.executeHQLQuery(str.toString());
|
||||
} catch (DataAccessLayerException e) {
|
||||
throw new EbxmlRegistryException("Data Access Error", e);
|
||||
}
|
||||
|
||||
return this.executeHQLQuery(str.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RoleType;
|
||||
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/30/2012 724 bphillip Initial creation
|
||||
* 3/13/2013 1082 bphillip Modified to use spring injection and transaction boundaries
|
||||
* 4/9/2013 1802 bphillip Removed exception catching
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -19,19 +19,18 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.services.cataloger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.Cataloger;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.CatalogObjectsResponse;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
/**
|
||||
* Implementation of the RegRep cataloger service
|
||||
|
@ -60,80 +59,18 @@ public class CatalogerImpl implements Cataloger {
|
|||
/** The data access object */
|
||||
private RegistryObjectTypeDao registryObjectDao;
|
||||
|
||||
@Resource
|
||||
private WebServiceContext wsContext;
|
||||
|
||||
@Override
|
||||
public CatalogObjectsResponse catalogObjects(
|
||||
CatalogObjectsRequest partCatalogObjectsRequest)
|
||||
throws MsgRegistryException {
|
||||
statusHandler.info("Cataloger received catalogObjects Request");
|
||||
throw EbxmlExceptionUtil.createMsgRegistryException(
|
||||
"Cataloger service not yet implemented",
|
||||
UnsupportedCapabilityExceptionType.class, "",
|
||||
"Unsupported Service", "Unsupported Service",
|
||||
ErrorSeverity.ERROR, statusHandler);
|
||||
statusHandler.info("Cataloger received catalogObjects Request from ["
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
|
||||
return EbxmlObjectUtil.spiObjectFactory.createCatalogObjectsResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indexes a registry object
|
||||
*
|
||||
* @param obj
|
||||
* The registry object to index
|
||||
* @throws EbxmlRegistryException
|
||||
* If the indexing process produces errors
|
||||
*/
|
||||
public void index(RegistryObjectType obj) throws EbxmlRegistryException {
|
||||
|
||||
// TODO:Implement Cataloger according to ebXML spec
|
||||
// if (obj instanceof AuditableEventType) {
|
||||
// return;
|
||||
// }
|
||||
// statusHandler.info("Cataloging object [" + obj.getId() + "]");
|
||||
// obj = registryObjectDao.getById(obj.getId());
|
||||
//
|
||||
// List<IndexEntry> entries = new ArrayList<IndexEntry>();
|
||||
//
|
||||
// if (obj.getName() != null) {
|
||||
// IndexEntry nameEntry = new IndexEntry(obj.getId(),
|
||||
// obj.getObjectType(), CanonicalIndices.NAME, obj.getName()
|
||||
// .getLocalizedString().get(0).getValue());
|
||||
// entries.add(syncEntry(nameEntry));
|
||||
// }
|
||||
//
|
||||
// if (obj.getDescription() != null) {
|
||||
// IndexEntry descEntry = new IndexEntry(obj.getId(),
|
||||
// obj.getObjectType(), CanonicalIndices.DESCRIPTION, obj
|
||||
// .getDescription().getLocalizedString().get(0)
|
||||
// .getValue());
|
||||
// entries.add(syncEntry(descEntry));
|
||||
// }
|
||||
// statusHandler.info("Persisting indexed values to registry for object ["
|
||||
// + obj.getId() + "]");
|
||||
// new RegistryDao(IndexEntry.class).saveOrUpdate(entries);
|
||||
// statusHandler.info("Catalog information persisted for object ["
|
||||
// + obj.getId() + "]");
|
||||
}
|
||||
|
||||
//
|
||||
// /**
|
||||
// * Syncs the given index entry with the database
|
||||
// *
|
||||
// * @param entry
|
||||
// * The entry to check
|
||||
// * @return The persistent entry if it exists, else the given object
|
||||
// * @throws EbxmlRegistryException
|
||||
// * If errors occur during the query
|
||||
// */
|
||||
// private IndexEntry syncEntry(IndexEntry entry)
|
||||
// throws EbxmlRegistryException {
|
||||
// List<IndexEntry> result = registryObjectDao.executeHQLQuery("from "
|
||||
// + IndexEntry.class.getName() + " x where x.key= "
|
||||
// + entry.getKey());
|
||||
// if (result.isEmpty()) {
|
||||
// return entry;
|
||||
// } else {
|
||||
// return result.get(0);
|
||||
// }
|
||||
// }
|
||||
|
||||
public void setRegistryObjectDao(RegistryObjectTypeDao registryObjectDao) {
|
||||
this.registryObjectDao = registryObjectDao;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.LifecycleManager;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
|
||||
|
@ -39,11 +42,11 @@ import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AssociationType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationNodeType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationSchemeType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ClassificationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExtensibleObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExternalIdentifierType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ExternalLinkType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.TaxonomyElementType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.VersionInfoType;
|
||||
|
@ -53,12 +56,18 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryExceptionType;
|
|||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnresolvedReferenceExceptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.spi.v4.ValidateObjectsResponse;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.event.EventBus;
|
||||
import com.raytheon.uf.common.registry.constants.ActionTypes;
|
||||
import com.raytheon.uf.common.registry.constants.AssociationTypes;
|
||||
import com.raytheon.uf.common.registry.constants.DeletionScope;
|
||||
import com.raytheon.uf.common.registry.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.common.registry.constants.StatusTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.event.InsertRegistryEvent;
|
||||
import com.raytheon.uf.common.registry.event.RegistryEvent.Action;
|
||||
|
@ -66,14 +75,7 @@ import com.raytheon.uf.common.registry.event.RegistryStatisticsEvent;
|
|||
import com.raytheon.uf.common.registry.event.RemoveRegistryEvent;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.audittrail.AuditTrailManager;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.ActionTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.AssociationTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.DeletionScope;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.StatusTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
|
@ -99,6 +101,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* Jan 18, 2012 bphillip Initial creation
|
||||
* Sep 14, 2012 1169 djohnson Throw exception when object exists during create only mode.
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring injection
|
||||
* 4/9/2013 1802 bphillip Changed how auditable events are handled
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -112,10 +115,14 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LifecycleManagerImpl.class);
|
||||
|
||||
@Resource
|
||||
private WebServiceContext wsContext;
|
||||
|
||||
/** The query manager */
|
||||
private QueryManagerImpl queryManager;
|
||||
|
||||
/** The validator */
|
||||
@SuppressWarnings("unused")
|
||||
private ValidatorImpl validator;
|
||||
|
||||
/** The cataloger */
|
||||
|
@ -125,7 +132,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
/** The registry object data access object */
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
||||
private AuditTrailManager auditTrailMgr;
|
||||
private AuditableEventTypeDao auditableEventDao;
|
||||
|
||||
/**
|
||||
* The Remove Objects protocol allows a client to remove or delete one or
|
||||
|
@ -141,7 +148,9 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
public RegistryResponseType removeObjects(RemoveObjectsRequest request)
|
||||
throws MsgRegistryException {
|
||||
long startTime = System.currentTimeMillis();
|
||||
statusHandler.info("LifecycleManager received removeObjectsRequest");
|
||||
statusHandler
|
||||
.info("LifecycleManager received removeObjectsRequest from ["
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
|
||||
RegistryResponseType response = EbxmlObjectUtil.rsObjectFactory
|
||||
.createRegistryResponseType();
|
||||
response.setRequestId(request.getId());
|
||||
|
@ -216,7 +225,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
if (query != null) {
|
||||
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
|
||||
.createResponseOptionType();
|
||||
responseOption.setReturnType("ObjectRef");
|
||||
responseOption.setReturnType(QueryReturnTypes.OBJECT_REF);
|
||||
QueryResponse queryResponse = queryManager.executeQuery(
|
||||
responseOption, query);
|
||||
if (queryResponse.getStatus()
|
||||
|
@ -231,8 +240,10 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
}
|
||||
}
|
||||
try {
|
||||
auditTrailMgr.createAuditTrailFromResponse(response,
|
||||
ActionTypes.delete);
|
||||
Map<String, List<ObjectRefType>> actionMap = new HashMap<String, List<ObjectRefType>>();
|
||||
actionMap.put(ActionTypes.delete, objRefs);
|
||||
auditableEventDao.createAuditableEventsFromRefs(request, actionMap,
|
||||
System.currentTimeMillis());
|
||||
registryObjectDao.deleteByRefs(objRefs);
|
||||
|
||||
} catch (EbxmlRegistryException e) {
|
||||
|
@ -263,15 +274,10 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
event.setLid(obj.getLid());
|
||||
event.setObjectType(objectType);
|
||||
EventBus.publish(event);
|
||||
// RegistrySessionManager.postEvent(event);
|
||||
}
|
||||
|
||||
EventBus.publish(new RegistryStatisticsEvent(obj.getObjectType(),
|
||||
obj.getStatus(), obj.getOwner(), avTimePerRecord));
|
||||
// all registry removals are logged for statistics
|
||||
// RegistrySessionManager.postEvent(new RegistryStatisticsEvent(obj
|
||||
// .getObjectType(), obj.getStatus(), obj.getOwner(),
|
||||
// avTimePerRecord));
|
||||
}
|
||||
|
||||
return response;
|
||||
|
@ -288,27 +294,12 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
* The LifecycleManager sends a RegistryResponse back to the client as
|
||||
* response.
|
||||
*/
|
||||
@Override
|
||||
public RegistryResponseType submitObjects(SubmitObjectsRequest request)
|
||||
throws MsgRegistryException {
|
||||
return submitObjects(request, true);
|
||||
}
|
||||
|
||||
public RegistryResponseType submitObjectsInternal(
|
||||
SubmitObjectsRequest request) throws MsgRegistryException {
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
return submitObjects(request, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits objects bypassing the validation step. This is used when
|
||||
* initializing the database
|
||||
*/
|
||||
protected RegistryResponseType submitObjects(SubmitObjectsRequest request,
|
||||
boolean validate) throws MsgRegistryException {
|
||||
statusHandler.info("LifecycleManager received submitObjectsRequest");
|
||||
statusHandler
|
||||
.info("LifecycleManager received submitObjectsRequest from ["
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
RegistryResponseType response = EbxmlObjectUtil.rsObjectFactory
|
||||
|
@ -339,25 +330,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
if (submitMode.equals(Mode.CREATE_OR_REPLACE)
|
||||
|| submitMode.equals(Mode.CREATE_OR_VERSION)
|
||||
|| submitMode.equals(Mode.CREATE_ONLY)) {
|
||||
|
||||
if (validate) {
|
||||
statusHandler.info("Validating objects...");
|
||||
ValidateObjectsResponse validateResponse = validateObjects(request
|
||||
.getRegistryObjectList());
|
||||
if (validateResponse.getException().isEmpty()) {
|
||||
statusHandler
|
||||
.info("Objects successfully validated! Submitting...");
|
||||
processSubmit(submitMode, objs, response, request.getId());
|
||||
} else {
|
||||
statusHandler
|
||||
.info("Objects failed to validate! submitObjects aborted!");
|
||||
response.getException().addAll(
|
||||
validateResponse.getException());
|
||||
}
|
||||
} else {
|
||||
statusHandler.info("Object validation skipped");
|
||||
processSubmit(submitMode, objs, response, request.getId());
|
||||
}
|
||||
// TODO: Add object validation
|
||||
processSubmit(request, response);
|
||||
} else {
|
||||
throw EbxmlExceptionUtil
|
||||
.createMsgRegistryException(
|
||||
|
@ -371,8 +345,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
}
|
||||
|
||||
response.setRequestId(request.getId());
|
||||
response.setObjectRefList(EbxmlObjectUtil
|
||||
.createObjectRefListFromObjects(objs));
|
||||
response.setObjectRefList(EbxmlObjectUtil.createObjectRefList(objs));
|
||||
long totalTime = System.currentTimeMillis() - startTime;
|
||||
statusHandler
|
||||
.info("LifeCycleManager submitObjects operation completed in "
|
||||
|
@ -386,15 +359,9 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
for (RegistryObjectType obj : objs) {
|
||||
EventBus.publish(new InsertRegistryEvent(obj.getId(), obj
|
||||
.getLid(), obj.getObjectType()));
|
||||
// RegistrySessionManager.postEvent(new InsertRegistryEvent(obj
|
||||
// .getId(), obj.getLid(), obj.getObjectType()));
|
||||
// also log a statistical event
|
||||
EventBus.publish(new RegistryStatisticsEvent(obj
|
||||
.getObjectType(), obj.getStatus(), obj.getOwner(),
|
||||
avTimePerRecord));
|
||||
// RegistrySessionManager.postEvent(new RegistryStatisticsEvent(
|
||||
// obj.getObjectType(), obj.getStatus(), obj.getOwner(),
|
||||
// avTimePerRecord));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,25 +426,6 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
+ object.getId() + "]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the given object list
|
||||
*
|
||||
* @param objectList
|
||||
* The list of objects to be validated
|
||||
* @return A response containing the status of the validation action
|
||||
* @throws MsgRegistryException
|
||||
* If errors occur during validation
|
||||
*/
|
||||
private ValidateObjectsResponse validateObjects(
|
||||
RegistryObjectListType objectList) throws MsgRegistryException {
|
||||
ValidateObjectsRequest validateRequest = EbxmlObjectUtil.spiObjectFactory
|
||||
.createValidateObjectsRequest();
|
||||
validateRequest.setOriginalObjects(objectList);
|
||||
validateRequest
|
||||
.setComment("Validation of objects before registry submission");
|
||||
return validator.validateObjects(validateRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Submits objects to the registry
|
||||
|
@ -493,18 +441,18 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
* @return time taken for transaction
|
||||
* @throws MsgRegistryException
|
||||
*/
|
||||
private void processSubmit(Mode submitMode, List<RegistryObjectType> objs,
|
||||
RegistryResponseType response, String requestId)
|
||||
throws MsgRegistryException {
|
||||
private void processSubmit(SubmitObjectsRequest request,
|
||||
RegistryResponseType response) throws MsgRegistryException {
|
||||
|
||||
Map<String, RegistryObjectType> storedObjects = new HashMap<String, RegistryObjectType>();
|
||||
List<RegistryObjectType> objsCreated = new ArrayList<RegistryObjectType>();
|
||||
List<RegistryObjectType> objsVersioned = new ArrayList<RegistryObjectType>();
|
||||
List<RegistryObjectType> objsUpdated = new ArrayList<RegistryObjectType>();
|
||||
for (RegistryObjectType obj : objs) {
|
||||
for (RegistryObjectType obj : request.getRegistryObjectList()
|
||||
.getRegistryObject()) {
|
||||
statusHandler.info("Processing object [" + obj.getId() + "]");
|
||||
if (obj.getId() == null) {
|
||||
if (submitMode.equals(Mode.CREATE_ONLY)) {
|
||||
if (request.getMode().equals(Mode.CREATE_ONLY)) {
|
||||
statusHandler
|
||||
.info("Generating id for object specified with CREATE_ONLY Mode");
|
||||
String uuid = EbxmlObjectUtil.getUUID();
|
||||
|
@ -534,18 +482,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
|
||||
}
|
||||
|
||||
List<RegistryObjectType> dbObjects = new ArrayList<RegistryObjectType>();
|
||||
try {
|
||||
dbObjects = registryObjectDao.getByLid(obj.getLid());
|
||||
} catch (EbxmlRegistryException e1) {
|
||||
throw EbxmlExceptionUtil.createMsgRegistryException(
|
||||
"Database submission error",
|
||||
InvalidRequestExceptionType.class, "",
|
||||
"Error querying for database objects",
|
||||
"The query for objects having lid [" + obj.getLid()
|
||||
+ "] failed", ErrorSeverity.ERROR, e1,
|
||||
statusHandler);
|
||||
}
|
||||
List<RegistryObjectType> dbObjects = registryObjectDao.getByLid(obj
|
||||
.getLid());
|
||||
storedObjects.clear();
|
||||
for (RegistryObjectType regObj : dbObjects) {
|
||||
storedObjects.put(regObj.getId(), regObj);
|
||||
|
@ -559,17 +497,26 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
obj.setVersionInfo(version);
|
||||
}
|
||||
|
||||
switch (submitMode) {
|
||||
switch (request.getMode()) {
|
||||
case CREATE_OR_REPLACE:
|
||||
if (storedObjects.containsKey(obj.getId())) {
|
||||
VersionInfoType versionInfo = storedObjects
|
||||
.get(obj.getId()).getVersionInfo();
|
||||
obj.setVersionInfo(versionInfo);
|
||||
obj.setStatus(storedObjects.get(obj.getId()).getStatus());
|
||||
/*
|
||||
* A server MUST NOT perform update operations via
|
||||
* SubmitObjects and UpdateObjects operations on a local
|
||||
* replica of a remote object. (Except in the case of
|
||||
* updating objects from notifications)
|
||||
*/
|
||||
checkReplica(request, obj, storedObjects.get(obj.getId()));
|
||||
statusHandler.info("Object [" + obj.getId()
|
||||
+ "] replaced in the registry.");
|
||||
registryObjectDao.delete(storedObjects.get(obj.getId()));
|
||||
// registryObjectDao.delete(storedObjects.get(obj.getId()));
|
||||
objsUpdated.add(obj);
|
||||
registryObjectDao
|
||||
.merge(obj, storedObjects.get(obj.getId()));
|
||||
|
||||
} else {
|
||||
obj.setStatus(StatusTypes.APPROVED);
|
||||
|
@ -577,6 +524,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
statusHandler.info("Object [" + obj.getId()
|
||||
+ "] added to the registry.");
|
||||
objsCreated.add(obj);
|
||||
registryObjectDao.create(obj);
|
||||
}
|
||||
break;
|
||||
case CREATE_OR_VERSION:
|
||||
|
@ -616,6 +564,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
.info("Supersedes association for new version of ["
|
||||
+ obj.getId()
|
||||
+ "] persisted to the registry");
|
||||
registryObjectDao.create(obj);
|
||||
} else {
|
||||
if (!dbObjects.isEmpty()) {
|
||||
EbxmlExceptionUtil
|
||||
|
@ -632,6 +581,7 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
statusHandler.info("Object [" + obj.getId()
|
||||
+ "] added to the registry.");
|
||||
objsCreated.add(obj);
|
||||
registryObjectDao.create(obj);
|
||||
}
|
||||
break;
|
||||
case CREATE_ONLY:
|
||||
|
@ -661,11 +611,11 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
statusHandler.info("Object [" + obj.getId()
|
||||
+ "] added to the registry.");
|
||||
objsCreated.add(obj);
|
||||
registryObjectDao.create(obj);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
registryObjectDao.create(obj);
|
||||
|
||||
// TODO: Implement proper cataloging of objects accorind to EbXML
|
||||
// spec
|
||||
|
@ -675,18 +625,18 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
statusHandler.info("Submit objects successful");
|
||||
statusHandler.info("Creating auditable events....");
|
||||
try {
|
||||
Map<String, List<RegistryObjectType>> actionMap = new HashMap<String, List<RegistryObjectType>>();
|
||||
if (!objsCreated.isEmpty()) {
|
||||
auditTrailMgr.createAuditTrail(objsCreated,
|
||||
ActionTypes.create, requestId);
|
||||
actionMap.put(ActionTypes.create, objsCreated);
|
||||
}
|
||||
if (!objsVersioned.isEmpty()) {
|
||||
auditTrailMgr.createAuditTrail(objsCreated,
|
||||
ActionTypes.version, requestId);
|
||||
actionMap.put(ActionTypes.version, objsVersioned);
|
||||
}
|
||||
if (!objsUpdated.isEmpty()) {
|
||||
auditTrailMgr.createAuditTrail(objsCreated,
|
||||
ActionTypes.update, requestId);
|
||||
actionMap.put(ActionTypes.update, objsUpdated);
|
||||
}
|
||||
auditableEventDao.createAuditableEventsFromObjects(request,
|
||||
actionMap, System.currentTimeMillis());
|
||||
} catch (EbxmlRegistryException e) {
|
||||
response.getException()
|
||||
.add(EbxmlExceptionUtil
|
||||
|
@ -704,6 +654,42 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
|
||||
}
|
||||
|
||||
private void checkReplica(SubmitObjectsRequest request,
|
||||
ExtensibleObjectType object1, ExtensibleObjectType object2)
|
||||
throws MsgRegistryException {
|
||||
boolean fromNotification = EbxmlObjectUtil.getHomeSlot(request) != null;
|
||||
String object1Home = EbxmlObjectUtil.getHomeSlot(object1);
|
||||
String object2Home = EbxmlObjectUtil.getHomeSlot(object2);
|
||||
|
||||
if (fromNotification) {
|
||||
if (object1Home != null && object2Home == null) {
|
||||
throw EbxmlExceptionUtil.createMsgRegistryException(
|
||||
"Cannot overwrite local object with replica",
|
||||
ObjectExistsExceptionType.class, "",
|
||||
"Cannot overwrite local object with replica", "",
|
||||
ErrorSeverity.ERROR, statusHandler);
|
||||
} else if (object1Home != null && object2Home != null) {
|
||||
if (!object1Home.equals(object2Home)) {
|
||||
throw EbxmlExceptionUtil
|
||||
.createMsgRegistryException(
|
||||
"Cannot overwrite a remote replica from a different server",
|
||||
ObjectExistsExceptionType.class,
|
||||
"",
|
||||
"Cannot overwrite a remote replica from a different server",
|
||||
"", ErrorSeverity.ERROR, statusHandler);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (object2Home != null) {
|
||||
throw EbxmlExceptionUtil.createMsgRegistryException(
|
||||
"Cannot update replicas",
|
||||
InvalidRequestExceptionType.class, "",
|
||||
"Cannot update replicas", "", ErrorSeverity.ERROR,
|
||||
statusHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void generatePaths(TaxonomyElementType element, String pathPrefix) {
|
||||
if (element instanceof ClassificationSchemeType) {
|
||||
ClassificationSchemeType scheme = (ClassificationSchemeType) element;
|
||||
|
@ -731,7 +717,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
@Override
|
||||
public RegistryResponseType updateObjects(UpdateObjectsRequest request)
|
||||
throws MsgRegistryException {
|
||||
statusHandler.info("LifecycleManager received updateObjects");
|
||||
statusHandler.info("LifecycleManager received updateObjects from ["
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
|
||||
throw EbxmlExceptionUtil.createMsgRegistryException(
|
||||
"updateObjects not yet implemented",
|
||||
UnsupportedCapabilityExceptionType.class, "",
|
||||
|
@ -751,8 +738,8 @@ public class LifecycleManagerImpl implements LifecycleManager {
|
|||
this.validator = validator;
|
||||
}
|
||||
|
||||
public void setAuditTrailMgr(AuditTrailManager auditTrailMgr) {
|
||||
this.auditTrailMgr = auditTrailMgr;
|
||||
public void setAuditableEventDao(AuditableEventTypeDao auditableEventDao) {
|
||||
this.auditableEventDao = auditableEventDao;
|
||||
}
|
||||
|
||||
public void setCataloger(CatalogerImpl cataloger) {
|
||||
|
|
|
@ -19,13 +19,47 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.services.notification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.NotificationListener;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.Mode;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.RemoveObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.lcm.v4.SubmitObjectsRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ObjectRefType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ActionTypes;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.registry.constants.DeletionScope;
|
||||
import com.raytheon.uf.common.registry.constants.QueryReturnTypes;
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.registry.services.RegistrySOAPServices;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.ClassificationNodeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.lifecycle.LifecycleManagerImpl;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
/**
|
||||
* Implementation of the ebxml notificationListenerImpl.
|
||||
|
@ -37,6 +71,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 3/18/2013 1082 bphillip Initial creation
|
||||
* 4/9/2013 1802 bphillip Implemented notification handling
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,10 +85,228 @@ public class NotificationListenerImpl implements NotificationListener {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(NotificationListenerImpl.class);
|
||||
|
||||
/**
|
||||
* The web service context information populated when this class is called
|
||||
* via a web service invocation
|
||||
*/
|
||||
@Resource
|
||||
private WebServiceContext wsContext;
|
||||
|
||||
/** The local lifecyclemanager instance */
|
||||
private LifecycleManagerImpl lcm;
|
||||
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
||||
/** The classification node data access object */
|
||||
private ClassificationNodeDao classificationNodeDao;
|
||||
|
||||
@Override
|
||||
public void onNotification(NotificationType notification) {
|
||||
String clientIP = EbxmlObjectUtil.getClientHost(wsContext);
|
||||
statusHandler.info("Received Notification: [" + notification.getId()
|
||||
+ "]");
|
||||
+ "] from [" + clientIP + "]");
|
||||
List<AuditableEventType> events = notification.getEvent();
|
||||
|
||||
// Process the received auditable events and add them to the appropriate
|
||||
// list based on the action performed
|
||||
for (AuditableEventType event : events) {
|
||||
List<ActionType> actions = event.getAction();
|
||||
for (ActionType action : actions) {
|
||||
String eventType = action.getEventType();
|
||||
|
||||
// Verify this is a valid event type
|
||||
if (!classificationNodeDao.isValidNode(eventType)) {
|
||||
statusHandler.info("Unknown event type [" + eventType
|
||||
+ "] received in notification");
|
||||
continue;
|
||||
}
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
if (action.getAffectedObjectRefs() != null) {
|
||||
for (ObjectRefType ref : action.getAffectedObjectRefs()
|
||||
.getObjectRef()) {
|
||||
ids.add(ref.getId());
|
||||
|
||||
}
|
||||
} else if (action.getAffectedObjects() != null) {
|
||||
for (RegistryObjectType regObj : action
|
||||
.getAffectedObjects().getRegistryObject()) {
|
||||
ids.add(regObj.getId());
|
||||
}
|
||||
} else {
|
||||
statusHandler.info("Event " + event.getId()
|
||||
+ " contains not affected objects ");
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
if (eventType.equals(ActionTypes.create)) {
|
||||
|
||||
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|
||||
clientIP, notification.getId(), ids,
|
||||
Mode.CREATE_OR_REPLACE);
|
||||
lcm.submitObjects(submitRequest);
|
||||
|
||||
} else if (eventType.equals(ActionTypes.update)) {
|
||||
SubmitObjectsRequest submitRequest = createSubmitObjectsRequest(
|
||||
clientIP, notification.getId(), ids,
|
||||
Mode.CREATE_OR_REPLACE);
|
||||
// TODO: When object update is implemented, this will
|
||||
// have to be
|
||||
// changed to call lcm.update
|
||||
lcm.submitObjects(submitRequest);
|
||||
} else if (eventType.equals(ActionTypes.delete)) {
|
||||
for (String id : ids) {
|
||||
RegistryObjectType object = registryObjectDao
|
||||
.getById(id);
|
||||
String replicaHome = EbxmlObjectUtil
|
||||
.getHomeSlot(object);
|
||||
if (clientIP.equals(replicaHome)) {
|
||||
ObjectRefType ref = new ObjectRefType();
|
||||
ref.setId(id);
|
||||
ObjectRefListType refList = new ObjectRefListType();
|
||||
refList.getObjectRef().add(ref);
|
||||
RemoveObjectsRequest request = RegistrySOAPServices
|
||||
.createRemoveObjectsRequest(
|
||||
"Remove Objects for notification ["
|
||||
+ notification.getId()
|
||||
+ "]",
|
||||
"Notification delete object submission",
|
||||
false,
|
||||
DeletionScope.DELETE_ALL,
|
||||
refList, null, null);
|
||||
lcm.removeObjects(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (EbxmlRegistryException e) {
|
||||
statusHandler.error(
|
||||
"Error getting remote objects to create", e);
|
||||
} catch (MsgRegistryException e) {
|
||||
statusHandler.error("Error creating objects in registry!",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method queries the client server to get the current state of the
|
||||
* affected objects and creates a SubmitObjectRequest
|
||||
*
|
||||
* @param clientIP
|
||||
* The remote server to get the current state of the registry
|
||||
* objects from
|
||||
* @param notificationId
|
||||
* The id of the received notification object
|
||||
* @param objIds
|
||||
* The ids of the objects that were affected
|
||||
* @param mode
|
||||
* The insert mode to be used
|
||||
* @return The SubmitObjectsRequest
|
||||
* @throws EbxmlRegistryException
|
||||
* If errors occur while creating the SubmitObjectsRequest
|
||||
*/
|
||||
private SubmitObjectsRequest createSubmitObjectsRequest(String clientIP,
|
||||
String notificationId, Collection<String> objIds, Mode mode)
|
||||
throws EbxmlRegistryException {
|
||||
try {
|
||||
// Get a the remote query service
|
||||
QueryManager queryManager = RegistrySOAPServices
|
||||
.getQueryServiceForHost(clientIP);
|
||||
// Create a query to get the current state of the affected objects
|
||||
QueryRequest queryRequest = createGetCurrentStateQuery(
|
||||
notificationId, objIds);
|
||||
// Query the remote server
|
||||
QueryResponse response = queryManager.executeQuery(queryRequest);
|
||||
List<RegistryObjectType> remoteObjects = response
|
||||
.getRegistryObjectList().getRegistryObject();
|
||||
// Set the home server slot on the object denoting the home server
|
||||
// of the received object.
|
||||
for (RegistryObjectType object : remoteObjects) {
|
||||
EbxmlObjectUtil.addStringSlot(object,
|
||||
EbxmlObjectUtil.HOME_SLOT_NAME, clientIP, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Attach a slot on the submit objects request that will later be
|
||||
* attached to the generated auditable event. This slot is used so
|
||||
* notfications will not ping pong back and forth between servers if
|
||||
* they have identical subscriptions with one another
|
||||
*/
|
||||
List<SlotType> slots = new ArrayList<SlotType>();
|
||||
slots.add(RegistryUtil.getSlot(String.class.getName(),
|
||||
EbxmlObjectUtil.HOME_SLOT_NAME, clientIP));
|
||||
RegistryObjectListType objectList = EbxmlObjectUtil
|
||||
.createRegistryObjectList(remoteObjects);
|
||||
// Create the submit objects request object
|
||||
SubmitObjectsRequest request = RegistrySOAPServices
|
||||
.createSubmitObjectRequest(
|
||||
"Submit Objects for notification ["
|
||||
+ notificationId + "]", mode,
|
||||
"Notification object submission", false,
|
||||
objectList, slots);
|
||||
return request;
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException("Error processing notification", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a QueryRequest to retrieve the current state of the objects
|
||||
* from a remote server.
|
||||
*
|
||||
* @param notificationId
|
||||
* The id of the received notification
|
||||
* @param ids
|
||||
* The ids of the affected objects for which we are getting the
|
||||
* current state
|
||||
* @return The QueryRequest object
|
||||
* @throws Exception
|
||||
* If errors occur while creating the query
|
||||
*/
|
||||
private QueryRequest createGetCurrentStateQuery(String notificationId,
|
||||
Collection<String> ids) {
|
||||
StringBuffer queryExpression = new StringBuffer();
|
||||
queryExpression.append("FROM RegistryObjectType obj WHERE obj.id in (");
|
||||
int idx = 0;
|
||||
for (String id : ids) {
|
||||
queryExpression.append("'").append(id).append("'");
|
||||
if (idx != ids.size() - 1) {
|
||||
queryExpression.append(",");
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
queryExpression.append(")");
|
||||
|
||||
ResponseOptionType responseOption = new ResponseOptionType();
|
||||
responseOption.setReturnComposedObjects(true);
|
||||
responseOption.setReturnType(QueryReturnTypes.REGISTRY_OBJECT);
|
||||
|
||||
List<SlotType> slots = new ArrayList<SlotType>(2);
|
||||
slots.add(RegistryUtil.getSlot(String.class.getName(), "queryLanguage",
|
||||
"HQL"));
|
||||
slots.add(RegistryUtil.getSlot(String.class.getName(),
|
||||
"queryExpression", queryExpression.toString()));
|
||||
QueryType selectorQuery = RegistrySOAPServices.createQueryType(
|
||||
CanonicalQueryTypes.ADHOC_QUERY, slots);
|
||||
return RegistrySOAPServices.createQueryRequest(
|
||||
"Query Request for notification [" + notificationId + "]",
|
||||
"Querying for current state of objects", selectorQuery,
|
||||
responseOption);
|
||||
}
|
||||
|
||||
public void setLcm(LifecycleManagerImpl lcm) {
|
||||
this.lcm = lcm;
|
||||
}
|
||||
|
||||
public void setRegistryObjectDao(RegistryObjectDao registryObjectDao) {
|
||||
this.registryObjectDao = registryObjectDao;
|
||||
}
|
||||
|
||||
public void setClassificationNodeDao(
|
||||
ClassificationNodeDao classificationNodeDao) {
|
||||
this.classificationNodeDao = classificationNodeDao;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,267 +0,0 @@
|
|||
package com.raytheon.uf.edex.registry.ebxml.services.notification;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.soap.MessageFactory;
|
||||
import javax.xml.soap.SOAPConstants;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPMessage;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ActionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.RegistryResponseType;
|
||||
|
||||
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
|
||||
import org.apache.commons.httpclient.HostConfiguration;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.apache.commons.httpclient.params.HttpMethodParams;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.StatusTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
@Transactional
|
||||
public class RegistryNotificationManager {
|
||||
|
||||
private DefaultHttpMethodRetryHandler httpMethodRetryHandler;
|
||||
|
||||
private JAXBContext jaxbResponseContext;
|
||||
|
||||
private Unmarshaller jaxbResponseUnmarshaller;
|
||||
|
||||
public RegistryNotificationManager() throws JAXBException {
|
||||
httpMethodRetryHandler = new DefaultHttpMethodRetryHandler(3, false);
|
||||
jaxbResponseContext = JAXBContext
|
||||
.newInstance(RegistryResponseType.class);
|
||||
jaxbResponseUnmarshaller = jaxbResponseContext.createUnmarshaller();
|
||||
}
|
||||
|
||||
public NotificationType createNotification(SubscriptionType subscription,
|
||||
List<RegistryObjectType> objectsOfInterest,
|
||||
List<AuditableEventType> eventsOfInterest) {
|
||||
|
||||
List<RegistryObjectType> objectsToRemove = new ArrayList<RegistryObjectType>();
|
||||
for (AuditableEventType event : eventsOfInterest) {
|
||||
List<ActionType> actionList = event.getAction();
|
||||
for (ActionType action : actionList) {
|
||||
objectsToRemove.clear();
|
||||
List<RegistryObjectType> regObjs = action.getAffectedObjects()
|
||||
.getRegistryObject();
|
||||
for (RegistryObjectType obj : regObjs) {
|
||||
boolean found = false;
|
||||
for (RegistryObjectType objOfInterest : objectsOfInterest) {
|
||||
if (objOfInterest.getId().equals(obj.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
objectsToRemove.add(obj);
|
||||
}
|
||||
}
|
||||
regObjs.removeAll(objectsToRemove);
|
||||
}
|
||||
}
|
||||
|
||||
// RegistryObjectType specific Fields
|
||||
NotificationType notification = new NotificationType();
|
||||
notification.setId(EbxmlObjectUtil.getUUID());
|
||||
notification.setLid(notification.getId());
|
||||
notification.setName(RegistryUtil
|
||||
.getInternationalString("Notification name"));
|
||||
notification.setDescription(RegistryUtil
|
||||
.getInternationalString("Notification Description"));
|
||||
notification.setObjectType(RegistryObjectTypes.NOTIFICATION);
|
||||
notification.setStatus(StatusTypes.APPROVED);
|
||||
notification.setOwner("EDEX_Internal_User");
|
||||
|
||||
// NotificationType specific fields
|
||||
notification.setSubscription(subscription.getId());
|
||||
notification.setEvent(eventsOfInterest);
|
||||
return notification;
|
||||
|
||||
}
|
||||
|
||||
public void sendNotificationViaSoap(NotificationType notification,
|
||||
String serviceAddress) throws EbxmlRegistryException {
|
||||
String notificationXml = null;
|
||||
SOAPMessage msg = null;
|
||||
|
||||
/*
|
||||
* Generate a new SOAP Message
|
||||
*/
|
||||
try {
|
||||
MessageFactory factory = MessageFactory
|
||||
.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
|
||||
msg = factory.createMessage();
|
||||
} catch (SOAPException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error creating notification SOAP message", e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Marshal the notification to XML string
|
||||
*/
|
||||
try {
|
||||
notificationXml = SerializationUtil.marshalToXml(notification);
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException("Error marshalling notification",
|
||||
e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Put the notification XML string into the soap message
|
||||
*/
|
||||
try {
|
||||
msg.getSOAPBody().setTextContent(notificationXml);
|
||||
} catch (SOAPException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error setting text content of SOAP Message", e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the SOAP request
|
||||
*/
|
||||
sendSoapMessage(msg, serviceAddress);
|
||||
}
|
||||
|
||||
private void sendSoapMessage(SOAPMessage message, String serviceAddress)
|
||||
throws EbxmlRegistryException {
|
||||
System.out.println("Sending SOAP Message to [" + serviceAddress
|
||||
+ "]...");
|
||||
|
||||
HostConfiguration hostConfig = new HostConfiguration();
|
||||
HttpClient client = new HttpClient();
|
||||
client.setHostConfiguration(hostConfig);
|
||||
PostMethod postMethod = null;
|
||||
|
||||
/*
|
||||
* Format soap message for transmission
|
||||
*/
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
RequestEntity reqEntity = null;
|
||||
try {
|
||||
message.writeTo(baos);
|
||||
reqEntity = new StringRequestEntity(
|
||||
StringEscapeUtils.unescapeXml(baos.toString()), "text/xml",
|
||||
"utf-8");
|
||||
} catch (SOAPException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error externalizing Soap message!", e);
|
||||
} catch (IOException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error writing soap message to byte array output stream!",
|
||||
e);
|
||||
} finally {
|
||||
if (baos != null) {
|
||||
try {
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error closing ByteArrayOutputStream!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the soap message via HTTP to desired service address
|
||||
*/
|
||||
try {
|
||||
postMethod = new PostMethod(serviceAddress);
|
||||
postMethod.setRequestEntity(reqEntity);
|
||||
postMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
|
||||
httpMethodRetryHandler);
|
||||
|
||||
/*
|
||||
* Post the message to the service address and check the response
|
||||
*/
|
||||
int httpStatus = client.executeMethod(postMethod);
|
||||
if (httpStatus == HttpStatus.SC_OK) {
|
||||
System.out.println("Soap Message transmission to ["
|
||||
+ serviceAddress + "] successful!");
|
||||
} else {
|
||||
throw new EbxmlRegistryException(
|
||||
"Soap message transmission to [" + serviceAddress
|
||||
+ "] failed with HTTP Status [" + httpStatus
|
||||
+ "]");
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the server response and validate
|
||||
*/
|
||||
byte[] responseBytes = null;
|
||||
try {
|
||||
responseBytes = postMethod.getResponseBody();
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException("Error reading response from "
|
||||
+ serviceAddress, e);
|
||||
}
|
||||
|
||||
ByteArrayInputStream responseInputStream = new ByteArrayInputStream(
|
||||
responseBytes);
|
||||
try {
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory
|
||||
.newInstance();
|
||||
dbf.setNamespaceAware(true);
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document d = db.parse(responseInputStream);
|
||||
NodeList responseNodeList = d.getElementsByTagNameNS(
|
||||
"urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0",
|
||||
"RegistryResponse");
|
||||
if (responseNodeList.getLength() == 0) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Invalid response returned from server!");
|
||||
}
|
||||
|
||||
RegistryResponseType registryResponse = jaxbResponseUnmarshaller
|
||||
.unmarshal(new DOMSource(responseNodeList.item(0)),
|
||||
RegistryResponseType.class).getValue();
|
||||
if (registryResponse.getStatus().equals(
|
||||
RegistryResponseStatus.SUCCESS)) {
|
||||
System.out.println("Soap service at [" + serviceAddress
|
||||
+ "] returned success response");
|
||||
} else {
|
||||
throw new EbxmlRegistryException("Soap service at ["
|
||||
+ serviceAddress + "] returned response: "
|
||||
+ registryResponse.getStatus());
|
||||
}
|
||||
} finally {
|
||||
if (responseInputStream != null) {
|
||||
responseInputStream.close();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error detected sending soap message to " + serviceAddress,
|
||||
e);
|
||||
} finally {
|
||||
postMethod.releaseConnection();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,157 +0,0 @@
|
|||
package com.raytheon.uf.edex.registry.ebxml.services.notification;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.ResponseOptionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.AuditableEventType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.NotificationType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SubscriptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.AuditableEventTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
public class RegistrySubscriptionManager {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(RegistrySubscriptionManager.class);
|
||||
|
||||
private RegistryNotificationManager notificationManager;
|
||||
|
||||
private QueryManagerImpl queryManager;
|
||||
|
||||
private RegistryObjectTypeDao subscriptionDao;
|
||||
|
||||
private AuditableEventTypeDao auditableEventDao;
|
||||
|
||||
public RegistrySubscriptionManager() {
|
||||
|
||||
}
|
||||
|
||||
public void processSubscriptions() throws EbxmlRegistryException,
|
||||
MsgRegistryException {
|
||||
// statusHandler
|
||||
// .info("---------------------PROCESSING SUBSCRIPTIONS----------------------------");
|
||||
|
||||
// List<SubscriptionType> subs = subscriptionDao
|
||||
// .getAllObjectsOfType(SubscriptionType.class);
|
||||
// for (SubscriptionType sub : subs) {
|
||||
// processSubscription(sub);
|
||||
// }
|
||||
}
|
||||
|
||||
private void processSubscription(SubscriptionType sub)
|
||||
throws MsgRegistryException, EbxmlRegistryException {
|
||||
// Get objects that match selector query
|
||||
QueryType selectorQuery = sub.getSelector();
|
||||
ResponseOptionType responseOption = EbxmlObjectUtil.queryObjectFactory
|
||||
.createResponseOptionType();
|
||||
responseOption.setReturnType(RegistryObjectType.class.getSimpleName());
|
||||
QueryResponse queryResponse = queryManager.executeQuery(responseOption,
|
||||
selectorQuery);
|
||||
List<RegistryObjectType> objectsOfInterest = queryResponse
|
||||
.getRegistryObjectList().getRegistryObject();
|
||||
|
||||
if (!objectsOfInterest.isEmpty()) {
|
||||
// Now get AuditableEvents that affected objectsOfInterest
|
||||
// MUST not include AuditableEvents that have already been delivered
|
||||
// to this subscriber
|
||||
List<AuditableEventType> eventsOfInterest = auditableEventDao
|
||||
.getEventsOfInterest(objectsOfInterest);
|
||||
if (!eventsOfInterest.isEmpty()) {
|
||||
NotificationType notification = notificationManager
|
||||
.createNotification(sub, objectsOfInterest,
|
||||
eventsOfInterest);
|
||||
List<String[]> addresses = null;
|
||||
try {
|
||||
addresses = getServiceAddressFromDeliveryInfo(sub);
|
||||
} catch (Exception e) {
|
||||
throw new EbxmlRegistryException(
|
||||
"Error extracting service addresses from subscription delivery info!",
|
||||
e);
|
||||
}
|
||||
if (addresses.isEmpty()) {
|
||||
statusHandler
|
||||
.warn("No destinations found for notification!");
|
||||
} else {
|
||||
for (String[] deliveryInfo : addresses) {
|
||||
if (deliveryInfo[0]
|
||||
.equals("urn:oasis:names:tc:ebxml-regrep:endPointType:soap")) {
|
||||
notificationManager.sendNotificationViaSoap(
|
||||
notification, deliveryInfo[1]);
|
||||
} else {
|
||||
statusHandler.warn("Unsupported delivery type: "
|
||||
+ deliveryInfo[1]
|
||||
+ ". Notification will not be delivered!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String[]> getServiceAddressFromDeliveryInfo(SubscriptionType sub)
|
||||
throws Exception {
|
||||
List<String[]> addresses = new ArrayList<String[]>();
|
||||
DocumentBuilderFactory docFactory = DocumentBuilderFactory
|
||||
.newInstance();
|
||||
docFactory.setNamespaceAware(true);
|
||||
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
||||
Document doc = docBuilder.parse(new InputSource(new StringReader(
|
||||
SerializationUtil.getJaxbManager().marshalToXml(sub))));
|
||||
|
||||
NodeList nodes = doc.getElementsByTagNameNS(
|
||||
"http://www.w3.org/2005/08/addressing", "Address");
|
||||
System.out.println(nodes.getLength());
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
Node addressNode = nodes.item(i);
|
||||
String endpointType = addressNode
|
||||
.getAttributes()
|
||||
.getNamedItemNS(
|
||||
"urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0",
|
||||
"endpointType").getNodeValue();
|
||||
String serviceAddress = addressNode.getNodeValue();
|
||||
addresses.add(new String[] { endpointType, serviceAddress });
|
||||
}
|
||||
return addresses;
|
||||
}
|
||||
|
||||
public void setQueryManager(QueryManagerImpl queryManager) {
|
||||
this.queryManager = queryManager;
|
||||
}
|
||||
|
||||
public void setSubscriptionDao(RegistryObjectTypeDao subscriptionDao) {
|
||||
this.subscriptionDao = subscriptionDao;
|
||||
}
|
||||
|
||||
public void setAuditableEventDao(AuditableEventTypeDao auditableEventDao) {
|
||||
this.auditableEventDao = auditableEventDao;
|
||||
}
|
||||
|
||||
public void setNotificationManager(
|
||||
RegistryNotificationManager notificationManager) {
|
||||
this.notificationManager = notificationManager;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,9 @@ package com.raytheon.uf.edex.registry.ebxml.services.query;
|
|||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.MsgRegistryException;
|
||||
import oasis.names.tc.ebxml.regrep.wsdl.registry.services.v4.QueryManager;
|
||||
|
@ -34,13 +36,13 @@ import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
|||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.RegistryResponseStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.types.IRegistryQuery;
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
|
||||
|
@ -83,6 +85,9 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
@Transactional
|
||||
public class QueryManagerImpl implements QueryManager {
|
||||
|
||||
@Resource
|
||||
private WebServiceContext wsContext;
|
||||
|
||||
private boolean eagerFetch = false;
|
||||
|
||||
protected static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -153,9 +158,9 @@ public class QueryManagerImpl implements QueryManager {
|
|||
throws MsgRegistryException {
|
||||
ITimer timer = TimeUtil.getTimer();
|
||||
timer.start();
|
||||
|
||||
statusHandler.info("QueryManager received executeQuery Request\n"
|
||||
+ queryRequest);
|
||||
statusHandler.info("QueryManager received executeQuery Request "
|
||||
+ queryRequest.getId() + " from ["
|
||||
+ EbxmlObjectUtil.getClientHost(wsContext) + "]");
|
||||
QueryResponse response = EbxmlObjectUtil.queryObjectFactory
|
||||
.createQueryResponse();
|
||||
response.setStatus(RegistryResponseStatus.SUCCESS);
|
||||
|
|
|
@ -22,23 +22,20 @@ package com.raytheon.uf.edex.registry.ebxml.services.query.types;
|
|||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryRequest;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.query.v4.QueryResponse;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectListType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.SlotType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rs.v4.UnsupportedCapabilityExceptionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.registry.ebxml.constants.ErrorSeverity;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectTypeDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.exception.EbxmlRegistryException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.QueryManagerImpl;
|
||||
|
@ -58,6 +55,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 2/21/2012 #184 bphillip Initial creation
|
||||
* 3/18/2013 1802 bphillip Modified to use transaction boundaries and spring dao injection
|
||||
* 4/9/2013 1802 bphillip Refactor of registry query handling
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,116 +68,44 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
|
|||
protected static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(IRegistryQuery.class);
|
||||
|
||||
protected abstract <T extends RegistryObjectType> List<T> query(
|
||||
QueryType queryType, QueryResponse queryResponse)
|
||||
throws EbxmlRegistryException;
|
||||
protected abstract void query(QueryType queryType,
|
||||
QueryResponse queryResponse) throws EbxmlRegistryException;
|
||||
|
||||
protected abstract List<String> getValidParameters();
|
||||
|
||||
protected boolean matchOlderVersions = false;
|
||||
|
||||
protected int maxResults = -1;
|
||||
|
||||
protected RETURN_TYPE returnType;
|
||||
|
||||
protected RegistryObjectTypeDao<RegistryObjectType> registryObjectDao;
|
||||
|
||||
public void executeQuery(QueryRequest queryRequest,
|
||||
QueryResponse queryResponse) throws EbxmlRegistryException {
|
||||
/*
|
||||
* The full functionality of querying will be implemented at a later
|
||||
* time under a different ticket. Parts of this method have been removed
|
||||
* and will be more efficiently implemented
|
||||
*/
|
||||
|
||||
// TODO: Implement version matching using matchOlderVersions
|
||||
// TODO: Handle max results. Partially handled currently by some queries
|
||||
// TODO: Add support for specifying query depth
|
||||
// TODO: Add support for start index
|
||||
|
||||
returnType = getReturnType(queryRequest.getResponseOption()
|
||||
.getReturnType());
|
||||
@SuppressWarnings("unused")
|
||||
int depth = queryRequest.getDepth().intValue();
|
||||
matchOlderVersions = queryRequest.isMatchOlderVersions();
|
||||
int maxResults = queryRequest.getMaxResults().intValue();
|
||||
int startIndex = queryRequest.getStartIndex().intValue();
|
||||
|
||||
List<RegistryObjectType> childQueryResults = query(
|
||||
queryRequest.getQuery(), queryResponse);
|
||||
List<RegistryObjectType> queryResults = null;
|
||||
if (matchOlderVersions) {
|
||||
queryResults = childQueryResults;
|
||||
} else {
|
||||
queryResults = new ArrayList<RegistryObjectType>();
|
||||
Map<String, RegistryObjectType> maxVersionMap = new HashMap<String, RegistryObjectType>();
|
||||
String lid = null;
|
||||
int objVersion = 0;
|
||||
for (RegistryObjectType regObj : childQueryResults) {
|
||||
int version = 0;
|
||||
if (regObj.getVersionInfo() == null) {
|
||||
queryResults.add(regObj);
|
||||
continue;
|
||||
} else {
|
||||
objVersion = Integer.parseInt(regObj.getVersionInfo()
|
||||
.getVersionName());
|
||||
}
|
||||
lid = regObj.getLid();
|
||||
|
||||
RegistryObjectType maxObj = maxVersionMap.get(lid);
|
||||
if (maxObj != null) {
|
||||
version = Integer.parseInt(maxObj.getVersionInfo()
|
||||
.getVersionName());
|
||||
}
|
||||
if (objVersion > version) {
|
||||
maxVersionMap.put(lid, regObj);
|
||||
}
|
||||
}
|
||||
queryResults.addAll(maxVersionMap.values());
|
||||
maxResults = queryRequest.getMaxResults().intValue();
|
||||
if (maxResults < 0) {
|
||||
maxResults = 0;
|
||||
}
|
||||
|
||||
RETURN_TYPE returnType = getReturnType(queryRequest.getResponseOption()
|
||||
.getReturnType());
|
||||
if (queryResults == null || queryResults.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<RegistryObjectType> results = new ArrayList<RegistryObjectType>();
|
||||
|
||||
int start = 0;
|
||||
if (maxResults <= QueryManagerImpl.DEFAULT_MAX_RESULTS) {
|
||||
results = queryResults;
|
||||
} else {
|
||||
if (startIndex <= QueryManagerImpl.DEFAULT_START_INDEX) {
|
||||
start = 0;
|
||||
} else {
|
||||
statusHandler.info("Start index is set to " + startIndex);
|
||||
start = startIndex;
|
||||
}
|
||||
for (int i = start; i < start + maxResults
|
||||
&& i < queryResults.size(); i++) {
|
||||
results.add(queryResults.get(i));
|
||||
}
|
||||
statusHandler.info((queryResults.size() - results.size())
|
||||
+ " items have been discarded from the result set.");
|
||||
}
|
||||
queryResponse.setStartIndex(new BigInteger(String.valueOf(start)));
|
||||
|
||||
switch (returnType) {
|
||||
case ObjectRef:
|
||||
queryResponse.setObjectRefList(EbxmlObjectUtil
|
||||
.createObjectRefListFromObjects(results));
|
||||
break;
|
||||
case RegistryObject:
|
||||
RegistryObjectListType objList = EbxmlObjectUtil.rimObjectFactory
|
||||
.createRegistryObjectListType();
|
||||
objList.getRegistryObject().addAll(results);
|
||||
queryResponse.setRegistryObjectList(objList);
|
||||
break;
|
||||
case LeafClass:
|
||||
// TODO: Add support for this type
|
||||
case LeafClassWithRepositoryItem:
|
||||
default:
|
||||
// TODO: Add support for this type
|
||||
queryResponse
|
||||
.getException()
|
||||
.add(EbxmlExceptionUtil
|
||||
.createRegistryException(
|
||||
UnsupportedCapabilityExceptionType.class,
|
||||
"",
|
||||
"Return type not currently not supported",
|
||||
"The ["
|
||||
+ returnType
|
||||
+ "] return type is currently not supported",
|
||||
ErrorSeverity.WARNING, statusHandler));
|
||||
break;
|
||||
}
|
||||
query(queryRequest.getQuery(), queryResponse);
|
||||
statusHandler.info("Query completed.");
|
||||
queryResponse.setTotalResultCount(new BigInteger(String.valueOf(results
|
||||
.size())));
|
||||
}
|
||||
|
||||
protected QueryParameters getParameterMap(Collection<SlotType> slots,
|
||||
|
@ -211,6 +137,42 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
|
|||
return parameters;
|
||||
}
|
||||
|
||||
protected void setResponsePayload(QueryResponse queryResponse,
|
||||
List<Object> values) {
|
||||
switch (returnType) {
|
||||
case ObjectRef:
|
||||
queryResponse.setObjectRefList(EbxmlObjectUtil
|
||||
.createObjectRefList(values));
|
||||
queryResponse.setTotalResultCount(BigInteger.valueOf(queryResponse
|
||||
.getObjectRefList().getObjectRef().size()));
|
||||
break;
|
||||
case RegistryObject:
|
||||
queryResponse.setRegistryObjectList(EbxmlObjectUtil
|
||||
.createRegistryObjectList(values));
|
||||
queryResponse.setTotalResultCount(BigInteger.valueOf(queryResponse
|
||||
.getRegistryObjectList().getRegistryObject().size()));
|
||||
break;
|
||||
case LeafClass:
|
||||
// TODO: Add support for this type
|
||||
case LeafClassWithRepositoryItem:
|
||||
default:
|
||||
// TODO: Add support for this type
|
||||
queryResponse
|
||||
.getException()
|
||||
.add(EbxmlExceptionUtil
|
||||
.createRegistryException(
|
||||
UnsupportedCapabilityExceptionType.class,
|
||||
"",
|
||||
"Return type not currently not supported",
|
||||
"The ["
|
||||
+ returnType
|
||||
+ "] return type is currently not supported",
|
||||
ErrorSeverity.WARNING, statusHandler));
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected QueryParameters getParameterMap(Collection<SlotType> slots,
|
||||
QueryResponse queryResponse) {
|
||||
return getParameterMap(slots, queryResponse, false);
|
||||
|
@ -261,4 +223,8 @@ public abstract class AbstractEbxmlQuery implements IRegistryQuery {
|
|||
this.registryObjectDao = registryObjectDao;
|
||||
}
|
||||
|
||||
public void setReturnType(RETURN_TYPE returnType) {
|
||||
this.returnType = returnType;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.edex.registry.ebxml.services.query.types;
|
||||
|
||||
import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
||||
|
||||
/**
|
||||
* Implementation of a canonical ebXML query
|
||||
|
@ -40,9 +39,6 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlObjectUtil;
|
|||
*/
|
||||
public abstract class CanonicalEbxmlQuery extends AbstractEbxmlQuery {
|
||||
|
||||
public static final String QUERY_CANONICAL_PREFIX = EbxmlObjectUtil.EBXML_PREFIX
|
||||
+ ":query:";
|
||||
|
||||
public boolean isCanonical() {
|
||||
return true;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue