List of usage examples for javax.xml.registry JAXRException JAXRException
public JAXRException(Throwable cause)
JAXRException
object initialized with the given Throwable
object. From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * Create a RegistryObject based on teh current setting of * objectTypeCombo//from www .ja v a 2 s . c o m * * @return DOCUMENT ME! * * @throws JAXRException DOCUMENT ME! */ @SuppressWarnings("unused") private RegistryObject createRegistryObject() throws JAXRException { RegistryObject ro = null; JAXRClient client = RegistryBrowser.getInstance().getClient(); BusinessLifeCycleManager lcm = client.getBusinessLifeCycleManager(); Concept objectTypeConcept = null; Object conceptsTreeNode = objectTypeCombo.getSelectedItemsObject(); Object nodeInfo = ((javax.swing.tree.DefaultMutableTreeNode) conceptsTreeNode).getUserObject(); if (nodeInfo instanceof it.cnr.icar.eric.client.ui.swing.NodeInfo) { Object obj = ((it.cnr.icar.eric.client.ui.swing.NodeInfo) nodeInfo).obj; if (obj instanceof javax.xml.registry.infomodel.Concept) { objectTypeConcept = (Concept) obj; if ((objectTypeConcept.getKey().getId() .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_AuditableEvent)) || (objectTypeConcept.getKey().getId() .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_Notification)) || (objectTypeConcept.getKey().getId() .equals(BindingUtility.CANONICAL_OBJECT_TYPE_ID_RegistryObject))) { throw new JAXRException( "Please choose a different item from ObjectType list. A user is not allowed to create an object of this type: " + objectTypeConcept.getKey().getId()); } } else { throw new JAXRException("Invalid objectType. Please choose a child item from ObjectType list."); } } it.cnr.icar.eric.client.xml.registry.util.QueryUtil qu = it.cnr.icar.eric.client.xml.registry.util.QueryUtil .getInstance(); ro = (RegistryObject) (((LifeCycleManagerImpl) lcm).createObject(objectTypeConcept)); return ro; }
From source file:it.cnr.icar.eric.common.BindingUtility.java
public String getSchemeIdForRegistryObject(RegistryObjectType ro) throws JAXRException { String schemeId = null;//from w w w. j ava 2 s .c o m if (ro instanceof ClassificationSchemeType) { schemeId = ro.getId(); } else if (ro instanceof ClassificationNodeType) { ClassificationNodeType node = (ClassificationNodeType) ro; String path = node.getPath(); schemeId = getSchemeIdFromNodePath(path); } else { throw new JAXRException(resourceBundle.getString("message.unexpectedObjectType", new String[] { ro.getClass().toString(), "org.oasis.ebxml.registry.bindings.rim.ClassificationSchemeType, org.oasis.ebxml.registry.bindings.rim.ClassificationNodeType" })); } return schemeId; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
@SuppressWarnings("unchecked") private void finalizeSubmitObjectList(ClientRequestContext context) throws JAXRException { HashSet<String> roIds = new HashSet<String>(); HashSet<String> refIds = new HashSet<String>(); if ((context.getCandidateSubmitObjects() == null) || (context.getCandidateSubmitObjects().size() == 0)) { return;/*from ww w.j a v a2 s . com*/ } for (Iterator<Object> it = context.getCandidateSubmitObjects().iterator(); it.hasNext();) { Object obj = it.next(); RegistryObjectImpl ro = null; IdentifiableType ebIdentifiableType = null; if (obj instanceof RegistryObjectImpl) { ro = (RegistryObjectImpl) obj; String id = ro.getId(); log.debug("finalizeSubmitObjectList: ro=" + ro + " modified=" + ro.isModified() + " new=" + ro.isNew()); if ((ro.isModified()) || (ro.isNew())) { log.debug("finalizeSubmitObjectList: submitting " + obj); if (obj instanceof ExtrinsicObject) { ExtrinsicObjectImpl eo = (ExtrinsicObjectImpl) obj; // Use getRepositoryItemInternal instead of // getRepositoryItem otherwise // we fetch RI from registry in the case where it was // being remove from EO // in this request DataHandler ri = eo.getRepositoryItemInternal(); // ebXML RS spec 2.0 allows ExtrinsicObject to exist // w/o RepositoryItem, but not JAXR 1.0 if (ri != null) { context.getRepositoryItemsMap().put(id, ri); } } if (obj instanceof Classification && context.getComposedObjects().contains(obj)) { // Special case: Classification: it should go as a // composed // object, inside its classified object. NO-OP. } else if (!(roIds.contains(id))) { roIds.add(id); ebIdentifiableType = (IdentifiableType) ro.toBindingObject(); context.getSubmitObjectsMap().put(ebIdentifiableType, ro); } } else { // Not modified or new. Create an ObjectRef if not already // being marshalled if (!(refIds.contains(id))) { refIds.add(id); ebIdentifiableType = rimFac.createObjectRefType(); ebIdentifiableType.setId(id); log.debug("finalizeSubmitObjectList: submitting ref to unmodified ro=" + ro); context.getSubmitObjectsMap().put(ebIdentifiableType, null); } } } else if (obj instanceof RegistryObjectRef) { RegistryObjectRef ref = (RegistryObjectRef) obj; // There may be multiple refs to same object. // Only add ObjectRef if it has not been added already String id = ref.getId(); if (!(refIds.contains(id))) { refIds.add(id); ebIdentifiableType = (IdentifiableType) ref.toBindingObject(); log.debug("finalizeSubmitObjectList: submitting ref=" + obj); context.getSubmitObjectsMap().put(ebIdentifiableType, null); } } else { throw new JAXRException(JAXRResourceBundle.getInstance() .getString("message.error.unexpected.ebxml.object.save", new Object[] { obj })); } } log.debug("finalizeSubmitObjectList: returning item count = " + context.getSubmitObjectsMap().size()); }
From source file:it.cnr.icar.eric.common.BindingUtility.java
/** * Makes an identical clone of a RegistryObjectType as a new java object. *///from www.java 2 s . co m public RegistryObjectType cloneRegistryObject(RegistryObjectType ebRegistryObjectType) throws JAXRException { RegistryObjectType ebRegistryObjectTypeNew = null; try { StringWriter sw = new StringWriter(); // wrap ComplexType as Element JAXBElement<RegistryObjectType> ebRegistryObject = rimFac.createRegistryObject(ebRegistryObjectType); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.marshal(ebRegistryObject, sw); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); @SuppressWarnings("unchecked") JAXBElement<RegistryObjectType> ebRegistryObjectNew = (JAXBElement<RegistryObjectType>) unmarshaller .unmarshal(new StreamSource(new StringReader(sw.toString()))); // take ComplexType from Element ebRegistryObjectTypeNew = ebRegistryObjectNew.getValue(); } catch (javax.xml.bind.JAXBException e) { throw new JAXRException(e); } return ebRegistryObjectTypeNew; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
private BulkResponse doSubmitObjectsRequestInternal(ClientRequestContext context) throws JAXRException { BulkResponseImpl response = null;/* w w w . j a v a2 s .c o m*/ try { SubmitObjectsRequest ebSubmitObjectsRequest = lcmFac.createSubmitObjectsRequest(); context.pushRegistryRequest(ebSubmitObjectsRequest); if (context.getSlotsMap() != null) { bu.addSlotsToRequest(ebSubmitObjectsRequest, context.getSlotsMap()); } //RegistryObjectListType ebRegistryObjectListType = bu.getRegistryObjectListType((RegistryObjectType) context.getSubmitObjectsMap().keySet()); @SuppressWarnings("unchecked") RegistryObjectListType ebRegistryObjectListType = bu .getRegistryObjectListType(context.getSubmitObjectsMap().keySet()); ebSubmitObjectsRequest.setRegistryObjectList(ebRegistryObjectListType); response = (BulkResponseImpl) doSubmitObjectsRequest(context); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { e.printStackTrace(); log.debug(e); throw new JAXRException(e); } finally { context.popRegistryRequest(); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
public BulkResponse doSubmitObjectsRequest(ClientRequestContext context) throws JAXRException { BulkResponseImpl response = null;//from w w w . j a va2 s . co m try { JAXRUtility.addCreateSessionSlot(context.getCurrentRegistryRequest(), regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.submitObjects(context); response = new BulkResponseImpl(this, ebResp, null); } catch (javax.xml.bind.JAXBException e) { e.printStackTrace(); log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
@SuppressWarnings("unused") private BulkResponse doUpdateObjectsRequest(ClientRequestContext context) throws JAXRException { BulkResponseImpl response = null;/*from w ww .j ava 2 s.com*/ try { org.oasis.ebxml.registry.bindings.lcm.UpdateObjectsRequest req = lcmFac.createUpdateObjectsRequest(); context.pushRegistryRequest(req); if (context.getSlotsMap() != null) { bu.addSlotsToRequest(req, context.getSlotsMap()); } RegistryObjectListType ebRegistryObjectListType = bu .getRegistryObjectListType((RegistryObjectType) context.getSubmitObjectsMap().keySet()); req.setRegistryObjectList(ebRegistryObjectListType); JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.updateObjects(context); checkCredentialInfo(); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } finally { context.popRegistryRequest(); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Sets the status of specified objects. This is an extension request that * will be adde to ebRR 3.1??//from ww w . j a va2 s . c o m * * <p> * <DL> * <DT><B>Capability Level: 1 </B> * </DL> * * @param keys * a Collection of keys for the objects to apply status change * to. * @param statusId * The id of the Concept within the canonical StatusType * ClassificationScheme. * * @return a BulkResponse containing the Collection of keys for those * objects that were deprecated successfully and any JAXRException * that was encountered in case of partial commit * * @throws JAXRException * if the JAXR provider encounters an internal error */ public BulkResponse setStatusOnObjects(Collection<?> keys, String statusId, AdhocQueryImpl query, HashMap<String, String> slotsMap) throws JAXRException { BulkResponseImpl response = null; List<ObjectRefType> orl = createObjectRefList(keys); try { SetStatusOnObjectsRequest req = lcmFac.createSetStatusOnObjectsRequest(); req.setStatus(statusId); if (slotsMap != null) { bu.addSlotsToRequest(req, slotsMap); } ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:setStatusOnObjects", req); ObjectRefListType ebObjectRefListType = rimFac.createObjectRefListType(); ebObjectRefListType.getObjectRef().addAll(orl); req.setObjectRefList(ebObjectRefListType); if (query != null) { AdhocQueryType ebAdhocQueryType = (AdhocQueryType) (query).toBindingObject(); req.setAdhocQuery(ebAdhocQueryType); } JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.setStatusOnObjects(context); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Deprecates one or more previously submitted objects. Deprecation marks an * object as "soon to be deleted". Once an object is deprecated, the JAXR * provider must not allow any new references (e.g. new Associations, * Classifications and ExternalLinks) to that object to be submitted. If a * client makes an API call that results in a new reference to a deprecated * object, the JAXR provider must throw a java.lang.IllegalStateException * within a JAXRException. However, existing references to a deprecated * object continue to function normally. * /*from ww w .j a v a 2 s .c o m*/ * <p> * <DL> * <DT><B>Capability Level: 1 </B> * </DL> * * @param keys * a Collection of keys for the objects to be deprecated * * @return a BulkResponse containing the Collection of keys for those * objects that were deprecated successfully and any JAXRException * that was encountered in case of partial commit * * @throws JAXRException * if the JAXR provider encounters an internal error */ public BulkResponse deprecateObjects(Collection<?> keys, AdhocQueryImpl query, HashMap<String, String> slotsMap) throws JAXRException { BulkResponseImpl response = null; List<ObjectRefType> orl = createObjectRefList(keys); try { org.oasis.ebxml.registry.bindings.lcm.DeprecateObjectsRequest req = lcmFac .createDeprecateObjectsRequest(); if (slotsMap != null) { bu.addSlotsToRequest(req, slotsMap); } ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:deprecateObjects", req); ObjectRefListType ebObjectRefListType = rimFac.createObjectRefListType(); ebObjectRefListType.getObjectRef().addAll(orl); req.setObjectRefList(ebObjectRefListType); if (query != null) { AdhocQueryType ebAdhocQueryType = (AdhocQueryType) (query).toBindingObject(); req.setAdhocQuery(ebAdhocQueryType); } JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.deprecateObjects(context); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }
From source file:it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl.java
/** * Undeprecates one or more previously deprecated objects. If an object was * not previously deprecated, it is not an error, and no exception is * thrown. Once an object is undeprecated, the JAXR provider must again * allow new references (e.g. new Associations, Classifications and * ExternalLinks) to that object to be submitted. * /* ww w . ja v a2 s . c o m*/ * <p> * <DL> * <DT><B>Capability Level: 1 </B> * </DL> * * @param keys * a Collection of keys for the objects to be undeprecated * * @return a BulkResponse containing the Collection of keys for those * objects that were deprecated successfully and any JAXRException * that was encountered in case of partial commit * * @throws JAXRException * if the JAXR provider encounters an internal error */ public BulkResponse unDeprecateObjects(Collection<?> keys, AdhocQueryImpl query, HashMap<String, String> slotsMap) throws JAXRException { BulkResponseImpl response = null; List<ObjectRefType> orl = createObjectRefList(keys); try { org.oasis.ebxml.registry.bindings.lcm.UndeprecateObjectsRequest req = lcmFac .createUndeprecateObjectsRequest(); if (slotsMap != null) { bu.addSlotsToRequest(req, slotsMap); } ClientRequestContext context = new ClientRequestContext( "it.cnr.icar.eric.client.xml.registry.LifeCycleManagerImpl:unDeprecateObjects", req); ObjectRefListType ebObjectRefListType = rimFac.createObjectRefListType(); ebObjectRefListType.getObjectRef().addAll(orl); req.setObjectRefList(ebObjectRefListType); if (query != null) { AdhocQueryType ebAdhocQueryType = (AdhocQueryType) (query).toBindingObject(); req.setAdhocQuery(ebAdhocQueryType); } JAXRUtility.addCreateSessionSlot(req, regService.getConnection()); checkCredentialInfo(); RegistryResponseType ebResp = serverLCM.unDeprecateObjects(context); response = new BulkResponseImpl(this, ebResp, null); // Now setCollection with ids of objects saved setKeysOnBulkResponse(context, response); } catch (javax.xml.bind.JAXBException e) { log.debug(e); throw new JAXRException(e); } return response; }