List of usage examples for java.lang Short toString
public String toString()
From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindISOLanguageISOCountryId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFGCashMssCFBindISOLanguageISOCountryId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//w w w .j a v a2s.c o m ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFGCashISOLanguageObj) { Short iSOCountryId = ((ICFGCashISOLanguageObj) genDef).getOptionalISOCountryId(); if (iSOCountryId == null) { ret = null; } else { ret = iSOCountryId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFGCashISOLanguageObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindContactURLURLProtocolId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFGCashMssCFBindContactURLURLProtocolId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/* w ww .j a va 2 s . com*/ ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFGCashContactURLObj) { Short uRLProtocolId = ((ICFGCashContactURLObj) genDef).getOptionalURLProtocolId(); if (uRLProtocolId == null) { ret = null; } else { ret = uRLProtocolId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFGCashContactURLObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMssCF.CFAccMssCFBindAccountEntryDebitCurrencyId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFAccMssCFBindAccountEntryDebitCurrencyId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/* ww w .j ava 2 s . com*/ ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFAccAccountEntryObj) { Short debitCurrencyId = ((ICFAccAccountEntryObj) genDef).getOptionalDebitCurrencyId(); if (debitCurrencyId == null) { ret = null; } else { ret = debitCurrencyId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFAccAccountEntryObj"); } return (ret); }
From source file:com.esri.geoevent.solutions.adapter.geomessage.DefenseOutboundAdapter.java
@SuppressWarnings("incomplete-switch") @Override//from w w w .j a v a 2 s . c om public synchronized void receive(GeoEvent geoEvent) { ByteBuffer byteBuffer = ByteBuffer.allocate(10 * 1024); Integer wkid = -1; String message = ""; message += "<geomessage v=\"1.0\">\n\r"; message += "<_type>"; message += messageType; message += "</_type>\n\r"; message += "<_action>"; message += "update"; message += "</_action>\n\r"; String messageid = UUID.randomUUID().toString(); message += "<_id>"; message += "{" + messageid + "}"; message += "</_id>\n\r"; MapGeometry geom = geoEvent.getGeometry(); if (geom.getGeometry().getType() == com.esri.core.geometry.Geometry.Type.Point) { Point p = (Point) geom.getGeometry(); message += "<_control_points>"; message += ((Double) p.getX()).toString(); message += ","; message += ((Double) p.getY()).toString(); message += "</_control_points>\n\r"; wkid = ((Integer) geom.getSpatialReference().getID()); } if (wkid > 0) { String wkidValue = wkid.toString(); message += "<_wkid>"; message += wkidValue.toString(); message += "</_wkid>\n\r"; } GeoEventDefinition definition = geoEvent.getGeoEventDefinition(); for (FieldDefinition fieldDefinition : definition.getFieldDefinitions()) { String attributeName = fieldDefinition.getName(); Object value = geoEvent.getField(attributeName); if (value == null || value.equals("null")) { continue; } FieldType t = fieldDefinition.getType(); if (t != FieldType.Geometry) { message += "<" + attributeName + ">"; switch (t) { case String: // if(((String)value).isEmpty()) // continue; message += value; break; case Date: Date date = (Date) value; message += (formatter.format(date)); break; case Double: Double doubleValue = (Double) value; message += doubleValue.toString(); break; case Float: Float floatValue = (Float) value; message += floatValue.toString(); break; case Integer: Integer intValue = (Integer) value; message += intValue.toString(); break; case Long: Long longValue = (Long) value; message += longValue.toString(); break; case Short: Short shortValue = (Short) value; message += shortValue.toString(); break; case Boolean: Boolean booleanValue = (Boolean) value; message += booleanValue.toString(); break; } message += "</" + attributeName + ">\n\r"; } else { if (definition.getIndexOf(attributeName) == definition.getIndexOf("GEOMETRY")) { continue; } else { String json = GeometryEngine.geometryToJson(wkid, (Geometry) value); message += "<" + attributeName + ">"; message += json; message += "</" + attributeName + ">\n\r"; } break; } } message += "</geomessage>"; // stringBuffer.append("</geomessages>"); message += "\r\n"; ByteBuffer buf = charset.encode(message); if (buf.position() > 0) buf.flip(); try { byteBuffer.put(buf); } catch (BufferOverflowException ex) { LOG.error( "Csv Outbound Adapter does not have enough room in the buffer to hold the outgoing data. Either the receiving transport object is too slow to process the data, or the data message is too big."); } byteBuffer.flip(); super.receive(byteBuffer, geoEvent.getTrackId(), geoEvent); byteBuffer.clear(); }
From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindAccountEntryDebitCurrencyId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFGCashMssCFBindAccountEntryDebitCurrencyId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//from w ww . ja v a 2s.com ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFGCashAccountEntryObj) { Short debitCurrencyId = ((ICFGCashAccountEntryObj) genDef).getOptionalDebitCurrencyId(); if (debitCurrencyId == null) { ret = null; } else { ret = debitCurrencyId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFGCashAccountEntryObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccMssCF.CFAccMssCFBindAccountEntryCreditCurrencyId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFAccMssCFBindAccountEntryCreditCurrencyId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }/*from w w w .j a v a 2 s . c o m*/ ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFAccAccountEntryObj) { Short creditCurrencyId = ((ICFAccAccountEntryObj) genDef).getOptionalCreditCurrencyId(); if (creditCurrencyId == null) { ret = null; } else { ret = creditCurrencyId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFAccAccountEntryObj"); } return (ret); }
From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCashMssCF.CFGCashMssCFBindAccountEntryCreditCurrencyId.java
public String expandBody(MssCFGenContext genContext) { final String S_ProcName = "CFGCashMssCFBindAccountEntryCreditCurrencyId.expandBody() "; if (genContext == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext"); }//from w w w .j a va 2 s . co m ICFLibAnyObj genDef = genContext.getGenDef(); if (genDef == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1, "genContext.getGenDef()"); } String ret; if (genDef instanceof ICFGCashAccountEntryObj) { Short creditCurrencyId = ((ICFGCashAccountEntryObj) genDef).getOptionalCreditCurrencyId(); if (creditCurrencyId == null) { ret = null; } else { ret = creditCurrencyId.toString(); } } else { throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody", "genContext.getGenDef()", genDef, "ICFGCashAccountEntryObj"); } return (ret); }
From source file:com.streamsets.pipeline.stage.origin.maprjson.MapRJsonOriginSource.java
private Record createRecordFromJSON(String lastSourceOffset, Document document) throws StageException { Record record;//from ww w .java 2s.c o m DataParser parser; try { if (jsonDataTypes.get(MAPR_ID) == Value.Type.BINARY) { String str; ByteBuffer bb = document.getIdBinary(); switch (bb.array().length) { case 8: Long l = Bytes.toLong(bb.array()); str = l.toString(); break; case 4: Integer i = Bytes.toInt(bb.array()); str = i.toString(); break; case 2: Short s = Bytes.toShort(bb.array()); str = s.toString(); break; default: str = Bytes.toString(bb.array()); break; } document.set(MAPR_ID, str); } if ((parser = parserFactory.getParser(lastSourceOffset, document.asJsonString())) == null) { LOG.error(Errors.MAPR_JSON_ORIGIN_05.getMessage()); throw new OnRecordErrorException(Errors.MAPR_JSON_ORIGIN_05); } } catch (DataParserException ex) { LOG.error(Errors.MAPR_JSON_ORIGIN_05.getMessage(), ex); throw new OnRecordErrorException(Errors.MAPR_JSON_ORIGIN_05, ex); } try { record = parser.parse(); } catch (IOException | DataParserException ex) { LOG.error(Errors.MAPR_JSON_ORIGIN_04.getMessage(), ex); throw new OnRecordErrorException(Errors.MAPR_JSON_ORIGIN_04, ex); } return record; }
From source file:com.tecapro.inventory.common.util.StringUtil.java
/** * Converter Short to String/*from w ww . j ava 2 s . c o m*/ * * @param value * Short * @param defaultValue * String * @return String */ public String toString(Short value, String defaultValue) { if (null == value) { return "" + defaultValue; } return value.toString(); }
From source file:com.jd.survey.web.survey.PublicSurveyController.java
/** * Handles the post from the submit page * @param proceed/*from w w w .j a v a 2s .co m*/ * @param survey * @param bindingResult * @param uiModel * @param httpServletRequest * @return */ @RequestMapping(value = "/submit", method = RequestMethod.POST, produces = "text/html") public String submitSurvey(@RequestParam(value = "id", required = true) Long surveyId, @RequestParam(value = "_submit", required = false) String proceedAction, Model uiModel, HttpServletRequest httpServletRequest) { log.info("submitPost(open): id= " + surveyId); try { if (proceedAction != null) { //submit button uiModel.asMap().clear(); Survey survey = surveyService.survey_submit(surveyId); SurveyDefinition surveyDefinition = surveySettingsService .surveyDefinition_findById(survey.getTypeId()); //survey definition not open to the public if (!surveyDefinition.getIsPublic()) { //attempt to access a private survey definition from a public open url log.warn(SURVEY_NOT_PUBLIC_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } //Attempt to access a survey from different IP Address if (!survey.getIpAddress().equalsIgnoreCase(httpServletRequest.getLocalAddr())) { log.warn( UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } if (surveyDefinition.getAllowMultipleSubmissions()) { return "redirect:/open/" + encodeUrlPathSegment(survey.getTypeId().toString(), httpServletRequest) + "?list"; } else { uiModel.asMap().clear(); StringWriter sw = new StringWriter(); VelocityContext velocityContext = new VelocityContext(); Velocity.evaluate(velocityContext, sw, "velocity-log", surveyDefinition.getCompletedSurveyTemplate()); uiModel.addAttribute("completedMessage", sw.toString().trim()); return "surveys/submitted"; } } else { uiModel.asMap().clear(); Survey survey = surveyService.survey_findById(surveyId); SurveyDefinition surveyDefinition = surveySettingsService .surveyDefinition_findById(survey.getTypeId()); //survey definition not open to the public if (!surveyDefinition.getIsPublic()) { //attempt to access a private survey definition from a public open url log.warn(SURVEY_NOT_PUBLIC_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } //Attempt to access a survey from different IP Address if (!survey.getIpAddress().equalsIgnoreCase(httpServletRequest.getLocalAddr())) { log.warn( UNAUTHORIZED_ATTEMPT_TO_ACCESS_SURVEY_WARNING_MESSAGE + httpServletRequest.getPathInfo() + FROM_IP_WARNING_MESSAGE + httpServletRequest.getLocalAddr()); return "accessDenied"; } List<SurveyPage> surveyPages = surveyService.surveyPage_getAll(surveyId, messageSource.getMessage(DATE_FORMAT, null, LocaleContextHolder.getLocale())); Short order = (short) surveyPages.size(); return "redirect:/open/" + encodeUrlPathSegment(survey.getId().toString(), httpServletRequest) + "/" + encodeUrlPathSegment(order.toString(), httpServletRequest); } } catch (Exception e) { log.error(e.getMessage(), e); throw (new RuntimeException(e)); } }