/** Add Mimetype to the MimetypeMap */ public void addMimetype(MimeType mimetype) { if (mimetype != null) // avoid null due to duplicates in database this.mimeTypeMap.put(mimetype.getName(), mimetype); }
public void addMimetype(MimeType mimeType) { if (mimetypes == null) mimetypes = new ArrayList(); if (!mimetypes.contains(mimeType.getName())) { mimetypes.add(mimeType); } }
/** Return true if this CapabilityMap supports the given MimeType */ public boolean supportsMimeType(MimeType mimeType) { Iterator<MimeType> mimetypes = mimeTypeMap.values().iterator(); while (mimetypes.hasNext()) { if (mimetypes.next().getName().equals(mimeType.getName())) { return true; } } return false; }
/** * Implements the equals operation so that 2 elements are equal if * all their member values are equal. * * * @param object to compare this one with * @return true if both objects represent the same (logical) content */ public boolean equals(Object object) { if (!(object instanceof MimeType)) { return false; } if (this == object) return true; // Don't check the ID - id is only set through OJB so this would not recognize equality correctly /* if (mimeTypeId != ((MimeType)object).getMimetypeId()) return false; */ String oName = ((MimeType)object).getName(); if (oName != null && name != null) { return oName.equals(name); } else if (oName == null && name == null) { return true; } else { return false; } }
temp.add(mt.getName());
JSMimeType jsMimeType = (JSMimeType) refs.mimeMap.get(mimeType.getName()); if (jsMimeType != null) jsMediaType.getMimeTypes().add(jsMimeType);
/** * exstract the mime types anmd save in snapshot file * * @throws SerializerException */ private void exportMimeTypes(Refs refs, JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { Iterator list = caps.getMimeTypes(); while (list.hasNext()) { try { MimeType _mt = (MimeType) list.next(); JSMimeType _jsM = new JSMimeType(); _jsM.setName(_mt.getName()); refs.mimeMap.put(_jsM.getName(), _jsM); refs.mimeMapInt.put(new Integer(_mt.getMimetypeId()), _jsM); snapshot.getMimeTypes().add(_jsM); } catch (Exception e) { throw new SerializerException( SerializerException.CREATE_SERIALIZED_OBJECT_FAILED .create(new String[] { "MimeType", e.getMessage()})); } } return; }
JSMimeType _mt = (JSMimeType) refs.mimeMap.get(_m.getName()); if (_mt != null) jsC.getMimeTypes().add(_mt);
if (myPrefMimeType.equalsIgnoreCase(_mt.getName())) client.setPreferredMimeTypeId(_mt.getMimetypeId());