public static String getIdentifier(@NotNull Configuration configuration, @Nullable String suffix) { //noinspection ConstantConditions if (configuration == null) { throw new IllegalArgumentException("Configuration parameter cannot be null."); } StringBuilder identifier = new StringBuilder(ID_PREFIX); // NOTE: Use the Configuration's id rather than its hash code, since the id will always be unique across multiple // configs and will not change if the Configuration is modified. // TODO (embedded): id will always be zero - perhaps the id could be set to a unique identifier for the entity to // which the Configuration applies (e.g. for a Resource Configuration, the Resource's path). int configId = (configuration.getId() != 0) ? configuration.getId() : configuration.hashCode(); identifier.append(configId); if (suffix != null) { identifier.append(suffix); } return identifier.toString(); }
public String toString(boolean verbose) { String resourceTypeString; if ((resourceType != null) && (resourceType.getClass() == ResourceType.class)) { // not null and not a Hibernate proxy - safe to invoke getters resourceTypeString = "{" + resourceType.getPlugin() + "}" + resourceType.getName(); } else { resourceTypeString = "[null]"; } String result; if (verbose) { result = "DriftDefinitionTemplate[id: " + id + ", name: " + name + ", resourceType: " + resourceTypeString + ", changeSetId: " + changeSetId + ", configuration: " + configuration + "]"; } else { String configId = (configuration != null) ? Integer.toString(configuration.getId()) : null; result = "DriftDefinitionTemplate[id: " + id + ", name: " + name + ", resourceType: " + resourceTypeString + ", " + "changeSetId: " + changeSetId + ", configuration[id: " + configId + "]]"; } return result; }
@Override public OperationHistory getOperationHistoryByHistoryId(Subject subject, int historyId) { OperationHistory history = entityManager.find(OperationHistory.class, historyId); if (history == null) { throw new IllegalArgumentException("Cannot get history - it does not exist: " + historyId); } if (history.getParameters() != null) { history.getParameters().getId(); // eagerly load it } if (history instanceof ResourceOperationHistory) { ResourceOperationHistory resourceHistory = (ResourceOperationHistory) history; if (resourceHistory.getResults() != null) { resourceHistory.getResults().getId(); // eagerly load it } } ensureViewPermission(subject, history); return history; }
public ServerPlugin getServerPluginRelationships(ServerPlugin plugin) { Query query = entityManager.createNamedQuery(ServerPlugin.QUERY_FIND_BY_NAME); query.setParameter("name", plugin.getName()); plugin = (ServerPlugin) query.getSingleResult(); Configuration config = plugin.getPluginConfiguration(); if (config != null) { config = entityManager.find(Configuration.class, config.getId()); plugin.setPluginConfiguration(config.deepCopy()); } config = plugin.getScheduledJobsConfiguration(); if (config != null) { config = entityManager.find(Configuration.class, config.getId()); plugin.setScheduledJobsConfiguration(config.deepCopy()); } return plugin; }
public void print(Configuration config) { out.println("Configuration [" + config.getId() + "] - " + config.getNotes()); for (PropertySimple p : config.getSimpleProperties().values()) { print(p, 1); } for (PropertyList p : config.getListProperties().values()) { print(p, 1); } for (PropertyMap p : config.getMapProperties().values()) { print(p, 1); } }
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public PackageVersion persistPackageVersion(PackageVersion pv) { // EM.persist requires related entities to be attached, let's attach them now // package has persist cascade enabled, so skip loading it if we'll allow it to be created here if (pv.getGeneralPackage().getId() > 0) { pv.setGeneralPackage(entityManager.find(Package.class, pv.getGeneralPackage().getId())); } // arch has persist cascade enabled, so skip loading it if we'll allow it to be created here if (pv.getArchitecture().getId() > 0) { pv.setArchitecture(entityManager.find(Architecture.class, pv.getArchitecture().getId())); } // config is optional but has persist cascade enabled, so skip loading it if we'll allow it to be created here if (pv.getExtraProperties() != null && pv.getExtraProperties().getId() > 0) { pv.setExtraProperties(entityManager.find(Configuration.class, pv.getExtraProperties().getId())); } // our object's relations are now full attached, we can persist it entityManager.persist(pv); return pv; }
persisted.getArchitecture().getId(); if (persisted.getExtraProperties() != null) { persisted.getExtraProperties().getId();
Integer configId = schedule.getParameters().getId(); Configuration parameters = configurationManager.getConfigurationById(configId); if (null != parameters) {
Integer configId = schedule.getParameters().getId(); Configuration parameters = configurationManager.getConfigurationById(configId); if (null != parameters) {
FacesComponentUtility.addParameter(viewEditLink, this.config, RequestParameterNameConstants.LIST_INDEX_PARAM, listIndex); int configId = this.config.getConfiguration().getId(); FacesComponentUtility.addParameter(viewEditLink, this.config, RequestParameterNameConstants.CONFIG_ID_PARAM, String.valueOf(configId));