use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException 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);
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class JcrServiceLevelAgreementProvider method slaCheckBuilder.
public ServiceLevelAgreementCheckBuilder slaCheckBuilder(ServiceLevelAgreement.ID slaId) {
try {
Session session = getSession();
Node n = session.getNodeByIdentifier(slaId.toString());
return new SLACheckBuilderImpl(n);
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Unable to create slaCheckBuilder. Error attempting to find related SLA by id of " + slaId);
}
}
use of com.thinkbiganalytics.metadata.modeshape.MetadataRepositoryException in project kylo by Teradata.
the class JcrPropertyUtil method setProperties.
public static Node setProperties(Session session, Node entNode, Map<String, Object> props) {
ValueFactory factory;
try {
factory = session.getValueFactory();
if (props != null) {
// JcrVersionUtil.ensureCheckoutNode(entNode);
for (Map.Entry<String, Object> entry : props.entrySet()) {
if (entry.getValue() instanceof JcrExtensiblePropertyCollection) {
JcrExtensiblePropertyCollection propertyCollection = ((JcrExtensiblePropertyCollection) entry.getValue());
propertyCollection.getCollectionType();
Value[] values = new Value[propertyCollection.getCollection().size()];
int i = 0;
for (Object o : propertyCollection.getCollection()) {
boolean weak = false;
if (propertyCollection.getCollectionType() == PropertyType.WEAKREFERENCE) {
weak = true;
}
Value value = createValue(session, o, weak);
values[i] = value;
i++;
}
entNode.setProperty(entry.getKey(), values);
} else {
Value value = asValue(factory, entry.getValue());
entNode.setProperty(entry.getKey(), value);
}
}
}
return entNode;
} catch (AccessDeniedException e) {
log.debug("Access denied", e);
throw new AccessControlException(e.getMessage());
} catch (RepositoryException e) {
throw new MetadataRepositoryException("Failed to set properties", e);
}
}
Aggregations