/** * Returns the filter group union type * * @return Filter group union type */ @Override public String getUnion() { return UnionType.OR.toString(); } }
/** * Retrieve join type as TYPE * * @return */ public JoinType getJoinType() { return type == null ? JoinType.INNER : JoinType.valueOf(type); }
/** * Set message type * * @param type Type (as string) * @return this */ public MessageBuilder setType(String type) { this.type = QueueMessageType.valueOf(type); return this; }
/** * Returns an answer given its type * * @param type * @return List of action answers */ public Answer getAnswer(AnswerType type) throws AWException { return getAnswer(type.toString()); }
/** * Get celldata type from value * @param value value * @return CellDataType */ public static CellDataType fromValue(String value) { if (value != null) { for (CellDataType cellDataType : values()) { if (cellDataType.type.equals(value)) { return cellDataType; } } } // Return a default value return getDefault(); }
/** * Gets the numeric format defined in numeric.properties * * @return numeric format */ private static NumberFormat getNumberFormat(String type) { NumberFormat numberFormat; // Apply locale based on numeric.properties switch (NumericType.getEnum(type)) { case AME: case AME_NO: // American formatting numberFormat = AMERICAN_NUMBER_FORMAT; break; default: // European formatting numberFormat = EUROPEAN_NUMBER_FORMAT; break; } // Apply rounding based on numeric.properties numberFormat.setRoundingMode(roundingType.getRoundingMode()); return numberFormat; } }
/** * Initialize Utility class * @param springEnvironment Spring environment */ public static void init(Environment springEnvironment) { Environment environment = springEnvironment; formattedPattern = environment.getProperty(AweConstants.PROPERTY_NUMERIC_PATTERN_FORMATTED, "###,###.####"); unformattedPattern = environment.getProperty(AweConstants.PROPERTY_NUMERIC_PATTERN_UNFORMATTED, "######.####"); numericFormat = environment.getProperty(AweConstants.PROPERTY_NUMERIC_FORMAT, "eur"); roundingType = RoundingType.fromCode(environment.getProperty(AweConstants.PROPERTY_NUMERIC_ROUND_TYPE, "S")); americanFormat = AMERICAN_NUMBER_FORMAT; americanFormat.setRoundingMode(roundingType.getRoundingMode()); }
/** * Finds out if a variable value is a list * * @param variable Variable * @return isList */ public boolean variableIsList(@NotNull Variable variable, ObjectNode parameters) throws AWException { boolean list = false; if (variable.getName() != null) { JsonNode nodeValue = getRequestParameter(variable.getName(), parameters); list = nodeValue != null && nodeValue.isArray() && nodeValue instanceof ArrayNode; } list = ParameterType.MULTIPLE_SEQUENCE.equals(ParameterType.valueOf(variable.getType())) || list; return list; }
/** * Retrieve enumerated value * * @param value Enumerated value * @return Enumerated */ public static AttributeRestrictionType getEnum(String value) { for (AttributeRestrictionType enumerated : values()) { if (enumerated.value.equalsIgnoreCase(value)) { return enumerated; } } throw new IllegalArgumentException(); }
/** * Retrieve enumerated value * * @param value * @return */ public static AnswerType getEnum(String value) { for (AnswerType enumerated : values()) { if (enumerated.value.equalsIgnoreCase(value)) { return enumerated; } } throw new IllegalArgumentException(); }
/** * Retrieve enumerated value * * @param value * @return */ public static NumericType getEnum(String value) { for (NumericType enumerated : values()) { if (enumerated.value.equalsIgnoreCase(value)) { return enumerated; } } throw new IllegalArgumentException(); }
/** * Generate class hashcode * * @return Class hashcode */ @Override public int hashCode() { // Get celldata hashcode (for comparison purposes) int hash = HASH_NUMBER; hash = HASH_MULTIPLIER * hash + (this.printable ? 1 : 0); hash = HASH_MULTIPLIER * hash + (this.stringValue != null ? this.stringValue.hashCode() : 0); hash = HASH_MULTIPLIER * hash + (this.objectValue != null ? this.objectValue.hashCode() : 0); hash = HASH_MULTIPLIER * hash + (this.type != null ? this.type.hashCode() : 0); return hash; }
private JsonNode getNumberParameter(JsonNode parameter, String stringParameter, Variable variable) { JsonNode output = parameter; if (parameter == null) { output = generateNumberNode(variable.getId(), stringParameter, ParameterType.valueOf(variable.getType())); } else if (!parameter.isNumber() && !parameter.isArray() && parameter.isTextual()) { output = generateNumberNode(variable.getId(), parameter.asText(), ParameterType.valueOf(variable.getType())); } return output; }
/** * Get phase SERVICES * * @param phase Phase to look into * @return Start Service list */ public List<Service> getPhaseServices(LaunchPhaseType phase) throws AWException { // Variable definition List<Service> phaseServices = new ArrayList<>(); // Search from application file to awe file for (Service service : serviceList.values()) { if (phase.toString().equalsIgnoreCase(service.getLaunchPhase())) { phaseServices.add(new Service(service)); } } // Return object return phaseServices; }
@Override public boolean equals(Object anotherObject) { if (anotherObject == null) { return false; } if (anotherObject instanceof QueryParameter) { QueryParameter anotherParameter = (QueryParameter) anotherObject; if (getType().equals(anotherParameter.getType())) { if (anotherParameter.getValue() == null || this.getValue() == null) { return this.getValue() == anotherParameter.getValue(); } return getValue().equals(anotherParameter.getValue()); } } return false; }
/** * Check file exists * * @param fileName File name * @return Check */ public ServiceData checkFile(String fileName) { ServiceData serviceData = new ServiceData(); String userHome = System.getProperty(USER_HOME); String selectsPath = userHome + SELECTS_PATH; String filePath = selectsPath + AweConstants.FILE_SEPARATOR + fileName + ".txt"; // Instantiate selects files path File folder = new File(selectsPath); // Check if path exists and create it if (!folder.exists()) { folder.mkdir(); } File file = new File(filePath); // Check if file already exists if (file.exists()) { serviceData.addVariable("MESSAGE_TYPE", AnswerType.ERROR.toString()); serviceData.addVariable("MESSAGE_TITLE", getLocale("WARNING_TITLE_DUPLICATED_FILE")); serviceData.addVariable("MESSAGE_DESCRIPTION", getLocale("WARNING_MESSAGE_DUPLICATED_FILE")); return serviceData; } serviceData.setType(AnswerType.OK); return serviceData; }
/** * Returns the filter group union type * * @return Filter group union type */ @Override public String getUnion() { return UnionType.AND.toString(); } }
@Override public Message createMessage(Session session) throws JMSException { // Create message switch (QueueMessageType.valueOf(getRequest().getType())) { case MAP: message = parseMapParameters(session.createMapMessage()); break; case TEXT: default: message = parseTextParameters(session.createTextMessage()); } // Add selector if defined if (selector != null) { message.setJMSType(selector); } // Set Message ID as correlation id message.setJMSCorrelationID(message.getJMSMessageID()); return message; }
/** * Add a error * * @param error Error to add as message */ public void addError(AWException error) { // Add element actions.add(new ClientAction("message") .addParameter(AweConstants.ACTION_MESSAGE_TYPE_ATTRIBUTE, error.getType().toString()) .addParameter(AweConstants.ACTION_MESSAGE_TITLE_ATTRIBUTE, error.getTitle()) .addParameter(AweConstants.ACTION_MESSAGE_DESCRIPTION_ATTRIBUTE, error.getMessage()) .setAsync(true) .setSilent(true)); }