/** * {@inheritDoc} */ @Override public <E extends AbstractStorageLabelType<?>> List<E> getLabelTypes(Class<E> labelTypeClass) { return loadAll(labelTypeClass); }
/** * {@inheritDoc} */ @Override public void removeLabels(Collection<AbstractStorageLabel<?>> labels) { for (AbstractStorageLabel<?> label : labels) { this.removeLabel(label); } }
this.saveLabelType(new AssigneeLabelType()); this.saveLabelType(new UseCaseLabelType()); List<RatingLabelType> ratingLabelTypeList = this.getLabelTypes(RatingLabelType.class); RatingLabelType ratingLabelType; if (CollectionUtils.isNotEmpty(ratingLabelTypeList)) { } else { ratingLabelType = new RatingLabelType(); this.saveLabelType(ratingLabelType); List<AbstractStorageLabel<String>> ratingLabelList = this.getAllLabelsForType(ratingLabelType); if (ratingLabelList.isEmpty()) { this.saveLabel(new StringStorageLabel("Very Bad", ratingLabelType)); this.saveLabel(new StringStorageLabel("Bad", ratingLabelType)); this.saveLabel(new StringStorageLabel("Medium", ratingLabelType)); this.saveLabel(new StringStorageLabel("Good", ratingLabelType)); this.saveLabel(new StringStorageLabel("Very Good", ratingLabelType)); List<StatusLabelType> statusLabelTypeList = this.getLabelTypes(StatusLabelType.class); StatusLabelType statusLabelType; if (CollectionUtils.isNotEmpty(statusLabelTypeList)) { } else { statusLabelType = new StatusLabelType(); this.saveLabelType(statusLabelType); List<AbstractStorageLabel<String>> statusLabelList = this.getAllLabelsForType(statusLabelType);
/** * {@inheritDoc} */ @Override public void removeLabelType(AbstractStorageLabelType<?> labelType) throws BusinessException { if (getAllLabelsForType(labelType).isEmpty()) { JpaUtil.delete(entityManager, labelType); } else { throw new BusinessException("Delete label type " + labelType.getClass().getSimpleName() + ".", StorageErrorCodeEnum.LABEL_TYPE_CAN_NOT_BE_DELETED); } }
List<SystemInformationData> systemInformationData = getSystemInformationData(Collections.singletonList(platformId)); if (CollectionUtils.isNotEmpty(systemInformationData)) { results.addAll(systemInformationData);
/** * {@inheritDoc} */ @Override public void saveLabelType(AbstractStorageLabelType<?> labelType) { if (labelType.isMultiType()) { entityManager.persist(labelType); } else { List<?> findByClass = loadAll(labelType.getClass()); if (findByClass.isEmpty()) { entityManager.persist(labelType); } } }
/** * {@inheritDoc} */ @Override public boolean saveLabel(AbstractStorageLabel<?> label) { if (label.getStorageLabelType().isValueReusable()) { List<?> exampleFind = loadAll(label.getClass()); if (!exampleFind.contains(label)) { AbstractStorageLabelType<?> labelType = label.getStorageLabelType(); if (null == labelType) { return false; } if ((labelType.getId() == 0) && !labelType.isMultiType()) { return false; } entityManager.persist(label); return true; } } return false; }