/* (non-Javadoc)
@see tuwien.auto.calimero.mgmt.ManagementClient#readPropertyDesc
(tuwien.auto.calimero.mgmt.Destination, int, int, int)
540385
public byte[] readPropertyDesc(Destination dst, int objIndex, int propID,
		int propIndex) throws KNXTimeoutException, KNXRemoteException,
		KNXDisconnectException, KNXLinkClosedException
	{
		if (objIndex < 0 || objIndex > 255 || propID < 0 || propID > 255 || propIndex < 0
			|| propIndex > 255)
			throw new KNXIllegalArgumentException("argument value out of range");
		final byte[] send =	DataUnitBuilder.createAPDU(PROPERTY_DESC_READ, new byte[] {
			(byte) objIndex, (byte) propID, (byte) (propID == 0 ? propIndex : 0) });
		final byte[] apdu = sendWait2(dst, priority, send, PROPERTY_DESC_RESPONSE, 7, 7);
		// max_nr_elem field is a 4bit exponent + 12bit unsigned
		// on problem this field is 0
		if (apdu[6] == 0 && apdu[7] == 0)
			throw new KNXRemoteException(
				"got no property description (object non-existant?)");
		return new byte[] { apdu[2], apdu[3], apdu[4], apdu[5], apdu[6], apdu[7], apdu[8] };
	}
1146761
public void addEntityPropertyDesc(EntityPropertyDesc entityPropertyDesc) {
    entityPropertyDescs.add(entityPropertyDesc);
    if (getQualifiedName().equals(entityPropertyDesc.getEntityClassName())) {
      ownEntityPropertyDescs.add(entityPropertyDesc);
    }
    if (entityPropertyDesc.isId()) {
      idEntityPropertyDescs.add(entityPropertyDesc);
    }
    if (entityPropertyDesc.isVersion()) {
      versionEntityPropertyDesc = entityPropertyDesc;
    }
  }
89394
protected void handleImportName(DaoDesc daoDesc, EntityDesc entityDesc) {
    classDescSupport.addImportName(daoDesc, ClassConstants.Dao);
    classDescSupport.addImportName(daoDesc, ClassConstants.Insert);
    classDescSupport.addImportName(daoDesc, ClassConstants.Update);
    classDescSupport.addImportName(daoDesc, ClassConstants.Delete);
    if (configClassName != null) {
      classDescSupport.addImportName(daoDesc, configClassName);
    }
    classDescSupport.addImportName(daoDesc, entityDesc.getQualifiedName());
    for (EntityPropertyDesc propertyDesc : entityDesc.getIdEntityPropertyDescs()) {
      classDescSupport.addImportName(daoDesc, propertyDesc.getPropertyClassName());
      classDescSupport.addImportName(daoDesc, ClassConstants.Select);
    }
    if (entityDesc.getIdEntityPropertyDescs().size() > 0) {
      classDescSupport.addImportName(daoDesc, ClassConstants.Select);
      for (EntityPropertyDesc propertyDesc : entityDesc.getIdEntityPropertyDescs()) {
        classDescSupport.addImportName(daoDesc, propertyDesc.getPropertyClassName());
      }
      if (entityDesc.getVersionEntityPropertyDesc() != null) {
        classDescSupport.addImportName(
            daoDesc, entityDesc.getVersionEntityPropertyDesc().getPropertyClassName());
      }
    }
  }
1310060
public void readObject(DataInputStream dataInputStream, ObjectManagerState objectManagerState) throws ObjectManagerException, IOException
    {
        super.readObject(dataInputStream, objectManagerState);

        // Read in the serialVersionUID
        dataInputStream.readLong();

        // Read in the number of slices we have
        int count = dataInputStream.readInt();

        _dataSlices = new ArrayList<DataSlice>(count);

        for (int i = 0; i < count; i++)
        {
            int length = dataInputStream.readInt();

            byte[] bytes = new byte[length];

            dataInputStream.readFully(bytes, 0, length);

            DataSlice slice = new DataSlice(bytes, 0, length);

            _dataSlices.add(slice);
        }
    }
1372224
private void readResourceCustomPropertyDefinitions(Resources gpResources)
   {
      CustomField field = m_projectFile.getCustomFields().getCustomField(ResourceField.TEXT1);
      field.setAlias("Phone");

      for (CustomPropertyDefinition definition : gpResources.getCustomPropertyDefinition())
      {
         //
         // Find the next available field of the correct type.
         //
         String type = definition.getType();
         FieldType fieldType = RESOURCE_PROPERTY_TYPES.get(type).getField();

         //
         // If we have run out of fields of the right type, try using a text field.
         //
         if (fieldType == null)
         {
            fieldType = RESOURCE_PROPERTY_TYPES.get("text").getField();
         }

         //
         // If we actually have a field available, set the alias to match
         // the name used in GanttProject.
         //
         if (fieldType != null)
         {
            field = m_projectFile.getCustomFields().getCustomField(fieldType);
            field.setAlias(definition.getName());
            String defaultValue = definition.getDefaultValue();
            if (defaultValue != null && defaultValue.isEmpty())
            {
               defaultValue = null;
            }
            m_resourcePropertyDefinitions.put(definition.getId(), new Pair<FieldType, String>(fieldType, defaultValue));
         }
      }
   }
1246100
private void readPropertiesFiles() {

        if (this.messageFileWildcard.isEmpty() || !CoreParameters.LOG_RESOLUTION.get()) {
            // Skip configuration loading
            LOGGER.info(JRebirthMarkers.MESSAGE, "Messages Loading is skipped");

        } else {
            // Assemble the regex pattern
            final Pattern filePattern = Pattern.compile(this.messageFileWildcard + "\\.properties");

            // Retrieve all resources from default classpath
            final Collection<String> list = ClasspathUtility.getClasspathResources(filePattern);

            LOGGER.info(JRebirthMarkers.MESSAGE, "{} Messages file{} found.", list.size(), list.size() > 1 ? "s" : "");

            for (final String rbFilename : list) {
                readPropertiesFile(rbFilename);
            }
        }
    }
324278
protected void descriminateType(
      EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
    String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
    if (Byte.class.getName().equals(defaultClassName)
        || Short.class.getName().equals(defaultClassName)
        || Integer.class.getName().equals(defaultClassName)
        || Long.class.getName().equals(defaultClassName)
        || Float.class.getName().equals(defaultClassName)
        || Double.class.getName().equals(defaultClassName)
        || BigInteger.class.getName().equals(defaultClassName)
        || BigDecimal.class.getName().equals(defaultClassName)
        || byte.class.getName().equals(defaultClassName)
        || short.class.getName().equals(defaultClassName)
        || int.class.getName().equals(defaultClassName)
        || long.class.getName().equals(defaultClassName)
        || float.class.getName().equals(defaultClassName)
        || double.class.getName().equals(defaultClassName)) {
      propertyDesc.setNumber(true);
    } else if (Time.class.getName().equals(defaultClassName)
        || LocalTime.class.getName().equals(defaultClassName)) {
      propertyDesc.setTime(true);
    } else if (Date.class.getName().equals(defaultClassName)
        || LocalDate.class.getName().equals(defaultClassName)) {
      propertyDesc.setDate(true);
    } else if (Timestamp.class.getName().equals(defaultClassName)
        || java.util.Date.class.getName().equals(defaultClassName)
        || LocalDateTime.class.getName().equals(defaultClassName)) {
      propertyDesc.setTimestamp(true);
    }
  }
1361740
public LocalizationDefinition getDestinationLocalizationDefinition(String destinationUuid) throws SINotPossibleInCurrentConfigurationException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getDestinationLocalizationDefinition", destinationUuid);

    checkStarted();
    
    LocalizationDefinition localizationDefinition = null;
    DestinationHandler destinationHandler = null;

    try
    {
      destinationHandler = destinationManager.getDestination(new SIBUuid12(destinationUuid), false);
    }
    catch (SITemporaryDestinationNotFoundException e)
    {
      // No FFDC code needed 
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationLocalizationDefinition", "SINotPossibleInCurrentConfigurationException");
      throw new SINotPossibleInCurrentConfigurationException(e.getMessage());
    }
    
    if(destinationHandler.isPubSub())
    {
      PubSubMessageItemStream pubSubMessageItemStream = destinationHandler.getPublishPoint();
      if (pubSubMessageItemStream != null)
      {
        localizationDefinition = pubSubMessageItemStream.getLocalizationDefinition();
      }
    }    
    else
    {
      PtoPLocalMsgsItemStream ptoPLocalMsgsItemStream = null;
      
      if ((!destinationHandler.isAlias()) && (!destinationHandler.isForeign()))
      {
        ptoPLocalMsgsItemStream = (PtoPLocalMsgsItemStream) destinationHandler.getQueuePoint(messageProcessor.getMessagingEngineUuid());
        if (ptoPLocalMsgsItemStream != null)
        {
          localizationDefinition = ptoPLocalMsgsItemStream.getLocalizationDefinition();
        }
      }
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getDestinationLocalizationDefinition", localizationDefinition);
     
    //TODO - return clone.  Cant do till admin implement clone() method (168499.21)
      
    return localizationDefinition;
  }
474594
static StructrPropertyDefinition deserialize(final StructrTypeDefinition parent, final String name, final Map<String, Object> source) {

		final String propertyType = (String)source.get(JsonSchema.KEY_TYPE);
		StructrPropertyDefinition newProperty = null;

		if (propertyType != null) {

			final boolean isDate   = source.containsKey(JsonSchema.KEY_FORMAT) && JsonSchema.FORMAT_DATE_TIME.equals(source.get(JsonSchema.KEY_FORMAT));
			final boolean isEnum   = source.containsKey(JsonSchema.KEY_ENUM);

			switch (propertyType) {

				case "string":	// can be string, date, enum or script

					if (isDate) {

						newProperty = new StructrDateProperty(parent, name);

					} else if (isEnum) {

						newProperty = new StructrEnumProperty(parent, name);

					} else {

						newProperty = new StructrStringProperty(parent, name);
					}
					break;

				case "password":
					newProperty = new StructrPasswordProperty(parent, name);
					break;

				case "thumbnail":
					newProperty = new StructrThumbnailProperty(parent, name);
					break;

				case "count":
					newProperty = new StructrCountProperty(parent, name);
					break;

				case "script":
					newProperty = new StructrScriptProperty(parent, name);
					break;

				case "function":
					newProperty = new StructrFunctionProperty(parent, name);
					break;

				case "boolean":
					newProperty = new StructrBooleanProperty(parent, name);
					break;

				case "number":
					newProperty = new StructrNumberProperty(parent, name);
					break;

				case "integer":
					newProperty = new StructrIntegerProperty(parent, name);
					break;

				case "long":
					newProperty = new StructrLongProperty(parent, name);
					break;

				case "custom":
					newProperty = new StructrCustomProperty(parent, name);
					break;

				case "encrypted":
					newProperty = new StructrEncryptedStringProperty(parent, name);
					break;

				case "object":

					// notion properties don't contain $link
					if (source.containsKey(JsonSchema.KEY_REFERENCE) && !source.containsKey(JsonSchema.KEY_LINK)) {

						final Object reference = source.get(JsonSchema.KEY_REFERENCE);
						if (reference != null && reference instanceof String) {

							final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
							newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "object", refName);
						}
					}
					break;

				case "array":

					// notion properties don't contain $link
					if (!source.containsKey(JsonSchema.KEY_LINK)) {

						final Map<String, Object> items = (Map)source.get(JsonSchema.KEY_ITEMS);
						if (items != null) {

							if (items.containsKey(JsonSchema.KEY_REFERENCE)) {

								final Object reference = items.get(JsonSchema.KEY_REFERENCE);
								if (reference != null && reference instanceof String) {

									final String refName = StructrPropertyDefinition.getPropertyNameFromJsonPointer(reference.toString());
									newProperty = new NotionReferenceProperty(parent, name, (String)source.get(JsonSchema.KEY_REFERENCE), "array", refName);
								}

							} else if (items.containsKey(JsonSchema.KEY_TYPE)) {

								final Object typeValue = items.get(JsonSchema.KEY_TYPE);
								if (typeValue != null) {

									switch (typeValue.toString()) {

										case "string":
											newProperty = new StructrStringArrayProperty(parent, name);
											break;

										case "integer":
											newProperty = new StructrIntegerArrayProperty(parent, name);
											break;

										case "long":
											newProperty = new StructrLongArrayProperty(parent, name);
											break;

										case "number":
											newProperty = new StructrNumberArrayProperty(parent, name);
											break;

										case "boolean":
											newProperty = new StructrBooleanArrayProperty(parent, name);
											break;

										case "date":
											newProperty = new StructrDateArrayProperty(parent, name);
											break;
									}
								}
							}
						}
					}
					break;
			}

		} else {

			throw new IllegalStateException("Property " + name + " has no type.");
		}

		if (newProperty != null) {
			newProperty.deserialize(source);
		}

		return newProperty;
	}
121671
private void resolveExceptionDestination(BaseDestinationDefinition dd) {

        String thisMethodName = "resolveExceptionDestination";

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, thisMethodName, dd.getName());
        }

        // If variable substitution string detected, then override ED name
        if (dd.isLocal()) {
            String ed = ((DestinationDefinition) dd).getExceptionDestination();
            if ((ed != null) && (ed.equals(JsConstants.DEFAULT_EXCEPTION_DESTINATION))) {
                ((DestinationDefinition) dd).setExceptionDestination(JsConstants.EXCEPTION_DESTINATION_PREFIX + this.getName());
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, thisMethodName);
        }
    }
985915
protected void copyProperties(Object dest, Object source) {
        try {
            BeanUtils.copyProperties(dest, source);
        } catch (Exception e) {
            String errorMessage = MessageFormat.format("M:{0};;E:{1}",
                    e.getCause().getMessage(), e.toString());
            throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
        }
    }
462620
@Override
    public DestinationType getDestinationType()
    {
        if (tc.isEntryEnabled())
            SibTr.entry(tc, "getDestinationType");

        DestinationType dt = getTarget().getDestinationType();

        if (tc.isEntryEnabled())
            SibTr.exit(tc, "getDestinationType", dt);

        return dt;
    }
240143
private void readProjectProperties(Gantt gantt)
   {
      Gantt.File file = gantt.getFile();
      ProjectProperties props = m_projectFile.getProjectProperties();
      props.setLastSaved(file.getSaved());
      props.setCreationDate(file.getCreated());
      props.setName(file.getName());
   }
1354341
@Override
	public final String getStringProperty(String name) throws JMSException
    {
        return MessageConvertTools.asString(getProperty(name));
    }
733326
public static SimpleFeatureCollection readPropertiesfile( String path ) throws IOException {

        OmsPropertiesFeatureReader reader = new OmsPropertiesFeatureReader();
        reader.file = path;
        reader.readFeatureCollection();

        return reader.geodata;
    }
865214
private void readResourceCustomFields(net.sf.mpxj.ganttproject.schema.Resource gpResource, Resource mpxjResource)
   {
      //
      // Populate custom field default values
      //
      Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();
      for (Pair<FieldType, String> definition : m_resourcePropertyDefinitions.values())
      {
         customFields.put(definition.getFirst(), definition.getSecond());
      }

      //
      // Update with custom field actual values
      //
      for (CustomResourceProperty property : gpResource.getCustomProperty())
      {
         Pair<FieldType, String> definition = m_resourcePropertyDefinitions.get(property.getDefinitionId());
         if (definition != null)
         {
            //
            // Retrieve the value. If it is empty, use the default.
            //
            String value = property.getValueAttribute();
            if (value.isEmpty())
            {
               value = null;
            }

            //
            // If we have a value,convert it to the correct type
            //
            if (value != null)
            {
               Object result;

               switch (definition.getFirst().getDataType())
               {
                  case NUMERIC:
                  {
                     if (value.indexOf('.') == -1)
                     {
                        result = Integer.valueOf(value);
                     }
                     else
                     {
                        result = Double.valueOf(value);
                     }
                     break;
                  }

                  case DATE:
                  {
                     try
                     {
                        result = m_localeDateFormat.parse(value);
                     }
                     catch (ParseException ex)
                     {
                        result = null;
                     }
                     break;
                  }

                  case BOOLEAN:
                  {
                     result = Boolean.valueOf(value.equals("true"));
                     break;
                  }

                  default:
                  {
                     result = value;
                     break;
                  }
               }

               if (result != null)
               {
                  customFields.put(definition.getFirst(), result);
               }
            }
         }
      }

      for (Map.Entry<FieldType, Object> item : customFields.entrySet())
      {
         if (item.getValue() != null)
         {
            mpxjResource.set(item.getKey(), item.getValue());
         }
      }
   }
1046568
@Override
    public <T> T readInstance(DatastoreType datastoreType) {
        return getInstance(datastoreType, TransactionalCache.Mode.READ);
    }