/** * This method should be called only if it has been determined that table schema should be created * (or deleted). Create the {@link CustomObject} for the metadata API to use during deploy * * @param cmd the class metadata for the entity * @param storeManager the store manager * @param mconn the managed connection that contains connections to the Force.com APIs */ public void createCustomObject( AbstractClassMetaData cmd, ForceStoreManager storeManager, ForceManagedConnection mconn) { String shortName = removeCustomThingSuffix(tableImpl.getTableName().getName()); if (isReadOnlyTable) { throw new NucleusUserException("Cannot create readOnlySchema custom object: " + shortName); } createCustomObjectStub(); customObject.setDescription(shortName + ": Persistenceforce created custom object"); customObject.setDeploymentStatus(DeploymentStatus.Deployed); customObject.setSharingModel(SharingModel.ReadWrite); customObject.setLabel(shortName); customObject.setPluralLabel(shortName); CustomField nf = new CustomField(); nf.setType(FieldType.Text); nf.setLabel("name"); nf.setFullName("name"); nf.setDescription("name"); customObject.setNameField(nf); Map<String, String> classExtensions = PersistenceUtils.getForceExtensions(cmd); String value = classExtensions.get("enableFeeds"); if (value != null) { customObject.setEnableFeeds(Boolean.valueOf(value)); } }
/** @return the value or NULL if the field is not found */ public String getCustomField(String fieldName) { for (CustomField f : customFields) { if (f.getName().equals(fieldName)) { return f.getValue(); } } return null; }
public void setField(String field, String value) { for (CustomField customField : fieldsList) { if (customField.field_id.equals(field)) { customField.value = value; return; } } fieldsList.add(new CustomField(field, value)); }
private static List<Parameter> getParameters(ArrayList<CustomField> infos, Entry entry) { List<Parameter> parameters = new ArrayList<>(); if (infos == null) return parameters; for (CustomField info : infos) { Parameter param = new Parameter(); param.setEntry(entry); param.setKey(info.getName()); param.setValue(info.getValue()); parameters.add(param); } return parameters; }
@Override protected void setInternalValue(Double newValue) { if (newValue != null) { super.setInternalValue(newValue); slider.setValue(newValue); } }
@Override public void commit() throws SourceException, InvalidValueException { Integer roleId = (Integer) roleBox.getValue(); if (roleId == -1) { user.setIsAccountOwner(Boolean.TRUE); } else { user.setIsAccountOwner(Boolean.FALSE); } setInternalValue(roleId); super.commit(); }
@Override public void setPropertyDataSource(Property newDataSource) { Object value = newDataSource.getValue(); if (value == null) { Object itemId = roleBox.getItemIds().iterator().next(); roleBox.setValue(itemId); } else if (value instanceof Integer) { roleBox.setValue(value); } super.setPropertyDataSource(newDataSource); }
@Override public String getEntityKey(CustomField entity) { return entity.getName(); }
protected void setPercentageValue(final Double value) { super.setValue(value); }
private CustomField getField(int id, String... values) { CustomField field = new CustomField(); field.setId(id); field.setValues(Arrays.asList(values)); return field; }