Search in sources :

Example 31 with Notification

use of com.icodici.universa.node2.Notification in project ORCID-Source by ORCID.

the class NotificationsApiServiceDelegatorImpl method findPermissionNotification.

@Override
@AccessControl(requiredScope = ScopePathType.PREMIUM_NOTIFICATION)
public Response findPermissionNotification(String orcid, Long id) {
    checkIfProfileDeprecated(orcid);
    Notification notification = notificationManager.findByOrcidAndId(orcid, id);
    if (notification != null) {
        checkSource(notification);
        return Response.ok(notification).build();
    } else {
        Map<String, String> params = new HashMap<String, String>();
        params.put("orcid", orcid);
        params.put("id", String.valueOf(id));
        throw new OrcidNotificationNotFoundException(params);
    }
}
Also used : HashMap(java.util.HashMap) OrcidNotificationNotFoundException(org.orcid.core.exception.OrcidNotificationNotFoundException) Notification(org.orcid.jaxb.model.notification_v2.Notification) AccessControl(org.orcid.core.security.visibility.aop.AccessControl)

Example 32 with Notification

use of com.icodici.universa.node2.Notification in project universa by UniversaBlockchain.

the class NetworkV2 method unpack.

private List<Notification> unpack(byte[] packedNotifications) throws IOException {
    List<Notification> nn = new ArrayList<>();
    try {
        // packet type code
        Boss.Reader r = new Boss.Reader(packedNotifications);
        if (r.readInt() != 1)
            throw new IOException("invalid packed notification type code");
        // from node number
        int number = r.readInt();
        NodeInfo from = getInfo(number);
        if (from == null)
            throw new IOException(myInfo.getNumber() + ": unknown node number: " + number);
        // number of notifications in the packet
        int count = r.readInt();
        if (count < 0 || count > 1000)
            throw new IOException("unvalid packed notifications count: " + count);
        for (int i = 0; i < count; i++) {
            nn.add(Notification.read(from, r));
        }
        return nn;
    } catch (Exception e) {
        // e.printStackTrace();
        report(getLabel(), "failed to unpack notification: " + e, DatagramAdapter.VerboseLevel.BASE);
        throw new IOException("failed to unpack notifications", e);
    }
}
Also used : Boss(net.sergeych.boss.Boss) NodeInfo(com.icodici.universa.node2.NodeInfo) IOException(java.io.IOException) Notification(com.icodici.universa.node2.Notification) IOException(java.io.IOException)

Example 33 with Notification

use of com.icodici.universa.node2.Notification in project narayana by jbosstm.

the class CompletionCoordinatorClient method sendRollback.

/**
 * Send a rollback request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendRollback(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint initiator = getCompletionInitiator(endpoint);
    AddressingHelper.installFromFaultTo(map, initiator, identifier);
    CompletionCoordinatorPortType port = getPort(endpoint, map, rollbackAction);
    Notification rollback = new Notification();
    port.rollbackOperation(rollback);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) CompletionCoordinatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionCoordinatorPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Example 34 with Notification

use of com.icodici.universa.node2.Notification in project narayana by jbosstm.

the class ParticipantClient method sendRollback.

/**
 * Send a rollback request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendRollback(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint coordinator = getCoordinator(endpoint, map);
    AddressingHelper.installFromFaultTo(map, coordinator, identifier);
    ParticipantPortType port = getPort(endpoint, map, rollbackAction);
    Notification rollback = new Notification();
    port.rollbackOperation(rollback);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) ParticipantPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.ParticipantPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Example 35 with Notification

use of com.icodici.universa.node2.Notification in project narayana by jbosstm.

the class ParticipantClient method sendCommit.

/**
 * Send a commit request.
 * @param map addressing context initialised with to and message ID.
 * @param identifier The identifier of the initiator.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendCommit(final W3CEndpointReference endpoint, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    MAPEndpoint coordinator = getCoordinator(endpoint, map);
    AddressingHelper.installFromFaultTo(map, coordinator, identifier);
    ParticipantPortType port = getPort(endpoint, map, commitAction);
    Notification commit = new Notification();
    port.commitOperation(commit);
}
Also used : MAPEndpoint(org.jboss.ws.api.addressing.MAPEndpoint) ParticipantPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.ParticipantPortType) Notification(org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)

Aggregations

Notification (org.oasis_open.docs.ws_tx.wsat._2006._06.Notification)28 Notification (org.orcid.jaxb.model.notification_v2.Notification)18 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)15 MAP (org.jboss.ws.api.addressing.MAP)15 MessageContext (javax.xml.ws.handler.MessageContext)13 Task (com.arjuna.services.framework.task.Task)11 Action (javax.xml.ws.Action)11 MAPEndpoint (org.jboss.ws.api.addressing.MAPEndpoint)11 HashMap (java.util.HashMap)8 Test (org.junit.Test)8 AccessControl (org.orcid.core.security.visibility.aop.AccessControl)6 NotificationAmended (org.orcid.jaxb.model.notification.amended_v2.NotificationAmended)5 NotificationPermission (org.orcid.jaxb.model.notification.permission_v2.NotificationPermission)5 NotificationInstitutionalConnection (org.orcid.model.notification.institutional_sign_in_v2.NotificationInstitutionalConnection)5 ArrayList (java.util.ArrayList)4 NotificationCustom (org.orcid.jaxb.model.notification.custom_v2.NotificationCustom)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)4 DBUnitTest (org.orcid.test.DBUnitTest)4 URISyntaxException (java.net.URISyntaxException)3 HashSet (java.util.HashSet)3