@Override @Transactional public void deleteResourceProp(String id) { final ResourcePropEntity entity = resourcePropDao.findById(id); if (entity != null) { resourcePropDao.delete(entity); } }
@Override @Transactional public void save(ResourcePropEntity entity) { if (StringUtils.isBlank(entity.getId())) { resourcePropDao.save(entity); } else { resourcePropDao.merge(entity); } }
@Override @Transactional public void addRequiredAttributes(ResourceEntity resource) { if (resource != null && resource.getType() != null && StringUtils.isNotBlank(resource.getType().getId())) { MetadataElementSearchBean sb = new MetadataElementSearchBean(); sb.addTypeId(resource.getType().getId()); List<MetadataElementEntity> elementList = elementDAO.getByExample(sb, -1, -1); if (CollectionUtils.isNotEmpty(elementList)) { for (MetadataElementEntity element : elementList) { if (element.isRequired()) { resourcePropDao.save(AttributeUtil.buildResAttribute(resource, element)); } } } } }
@Override @Transactional(readOnly = true) public String getResourcePropValueByName(final String resourceId, final String propName) { return resourcePropDao.findValueByName(resourceId, propName); }
@Override @Transactional(readOnly = true) public ResourcePropEntity findResourcePropById(String id) { return resourcePropDao.findById(id); }