Search in sources :

Example 1 with SlaId

use of com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId in project kylo by Teradata.

the class JcrServiceLevelAgreementProvider method removeAgreement.

/* (non-Javadoc)
     * @see com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementProvider#removeAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement.ID)
     */
@Override
public boolean removeAgreement(ID id) {
    try {
        Session session = getSession();
        SlaId slaId = (SlaId) id;
        Node slaNode = session.getNodeByIdentifier(slaId.getIdValue());
        if (slaNode != null) {
            JcrServiceLevelAgreement sla = new JcrServiceLevelAgreement(slaNode);
            addPostSlaChangeAction(sla, MetadataChange.ChangeType.DELETE);
            // remove any other relationships
            feedServiceLevelAgreementProvider.removeAllRelationships(id);
            slaNode.remove();
        }
        return true;
    } catch (ItemNotFoundException e) {
        return false;
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to retrieve the SLA node", e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) SlaId(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId) Node(javax.jcr.Node) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Session(javax.jcr.Session) ItemNotFoundException(javax.jcr.ItemNotFoundException)

Example 2 with SlaId

use of com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId in project kylo by Teradata.

the class JcrServiceLevelAgreementProvider method getAgreement.

/* (non-Javadoc)
     * @see com.thinkbiganalytics.metadata.sla.spi.ServiceLevelAgreementProvider#getAgreement(com.thinkbiganalytics.metadata.sla.api.ServiceLevelAgreement.ID)
     */
@Override
public ServiceLevelAgreement getAgreement(ID id) {
    try {
        Session session = getSession();
        SlaId slaId = (SlaId) id;
        return new JcrServiceLevelAgreement(session.getNodeByIdentifier(slaId.getIdValue()));
    } catch (ItemNotFoundException e) {
        return null;
    } catch (RepositoryException e) {
        throw new MetadataRepositoryException("Failed to retrieve the SLA node", e);
    }
}
Also used : MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) SlaId(com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId) MetadataRepositoryException(com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException) RepositoryException(javax.jcr.RepositoryException) Session(javax.jcr.Session) ItemNotFoundException(javax.jcr.ItemNotFoundException)

Aggregations

MetadataRepositoryException (com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException)2 SlaId (com.thinkbiganalytics.metadata.modeshape.sla.JcrServiceLevelAgreement.SlaId)2 ItemNotFoundException (javax.jcr.ItemNotFoundException)2 RepositoryException (javax.jcr.RepositoryException)2 Session (javax.jcr.Session)2 Node (javax.jcr.Node)1