}\r
\r
public ModuleSADocument.ModuleSA getModuleSA(String key) {\r
- String[] s = key.split(" ");\r
+ \r
if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {\r
removeElement(getfpdFrameworkModules());\r
fpdFrameworkModules = null;\r
return null;\r
}\r
+ String[] s = key.split(" ");\r
+ String archsInKey = "";\r
+ if (s.length > 4) {\r
+ for (int i = 4; i < s.length; ++i) {\r
+ archsInKey += s[i];\r
+ archsInKey += " ";\r
+ }\r
+ archsInKey = archsInKey.trim();\r
+ }\r
+ \r
ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r
while(li.hasNext()) {\r
ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();\r
continue;\r
}\r
}\r
- //ToDo add arch check for s[4]\r
+ //ToDo add arch check .\r
if (moduleSa.getSupArchList() != null) {\r
- if (!listToString(moduleSa.getSupArchList()).equals(s[4])) {\r
- continue;\r
+ if (listToString(moduleSa.getSupArchList()).equals(archsInKey)) {\r
+ return moduleSa;\r
+ }\r
+ }\r
+ else {\r
+ if (archsInKey.length() == 0) {\r
+ return moduleSa;\r
}\r
}\r
- return moduleSa;\r
}\r
}\r
return null;\r
}\r
}\r
\r
- public void AddFvImageFvImageNames (String[] fvNames) {\r
+ public void addFvImageFvImageNames (String[] fvNames) {\r
FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();\r
if (fis == null || fis.getFvImageList() == null) {\r
genFvImagesFvImage (fvNames, "ImageName", null);\r
while (li.hasNext()) {\r
FvImagesDocument.FvImages.FvImage fi = li.next();\r
if (fi.getType().toString().equals("ImageName")) {\r
- for (int i = 0; i < fvNames.length; ++i) {\r
- fi.addFvImageNames(fvNames[i]);\r
- }\r
+ addFvImageNamesInFvImage (fi, fvNames);\r
return;\r
}\r
}\r
- genFvImagesFvImage (fvNames, "ImageName", null);\r
+ genFvImagesFvImage (fvNames, "ImageName", null); \r
+ }\r
+ \r
+ public void addFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String[] fvNames) {\r
\r
+ for (int i = 0; i < fvNames.length; ++i) {\r
+ fi.addFvImageNames(fvNames[i]);\r
+ }\r
+ }\r
+ \r
+ public void addFvImageNamesInFvImage (int i, String[] fvNames) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ addFvImageNamesInFvImage(fi, fvNames);\r
+ }\r
+ cursor.dispose();\r
}\r
\r
public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {\r
}\r
}\r
\r
+ public void updateFvImageNamesInFvImage (int i, String oldFvName, String newFvName) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ updateFvImageNamesInFvImage (fi, oldFvName, newFvName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
/**\r
* @param fi\r
* @param oldFvName The FV Name to be replaced.\r
cursor.setTextValue(newFvName);\r
}\r
else {\r
- cursor.removeXml();\r
+ cursor.removeXml();\r
}\r
}\r
}while (cursor.toNextSibling(qFvImageNames));\r
cursor.dispose();\r
}\r
\r
+ /**update the Type attribute of ith FvImage with new type.\r
+ * @param i\r
+ * @param type\r
+ */\r
+ public void updateFvImagesFvImageType (int i, String type) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ fi.setType(FvImageTypes.Enum.forString(type));\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){\r
\r
XmlObject o = getfpdFlash().getFvImages();\r
}\r
}\r
\r
+ public void removeFvImageNameValue (int i, String attributeName) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ removeFvImageNameValue (fi, attributeName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ /**Remove from fi the attribute pair with attributeName in FvImageOptions.\r
+ * @param fi\r
+ * @param attributeName\r
+ */\r
+ public void removeFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String attributeName) {\r
+ if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {\r
+ ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
+ if (nv.getName().equals(attributeName)) {\r
+ li.remove();\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
public void removeTypedNamedFvImageNameValue (String fvName, String type, String optName) {\r
Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName(fvName, type);\r
for (int i = 0; i < vFvImage.size(); ++i) {\r
FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);\r
- if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {\r
- ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r
- while (li.hasNext()) {\r
- FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
- if (nv.getName().equals(optName)) {\r
- li.remove();\r
- }\r
- }\r
- }\r
+ removeFvImageNameValue (fi, optName);\r
}\r
}\r
\r
\r
}\r
\r
+ public void setFvImagesFvImageNameValue (int i, String name, String value) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
/**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.\r
* @param fi\r
* @param name\r
*/\r
public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {\r
if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.addNewFvImageOptions().addNewNameValue();\r
+ nv.setName(name);\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
return;\r
}\r
\r
}\r
}\r
}\r
+ \r
+ public int getFvImagePosInFvImages (String fvNameList, String type) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return -1;\r
+ }\r
+ \r
+ int pos = -1;\r
+ String[] fvNameArray = fvNameList.trim().split(" ");\r
+ Vector<String> vFvNames = new Vector<String>();\r
+ \r
+ \r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ do {\r
+ pos++;\r
+ vFvNames.removeAllElements();\r
+ for (int i = 0; i < fvNameArray.length; ++i) {\r
+ vFvNames.add(fvNameArray[i]);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ if (!fi.getType().toString().equals(type)) {\r
+ continue;\r
+ }\r
+ if (fi.getFvImageNamesList() == null || fi.getFvImageNamesList().size() != vFvNames.size()) {\r
+ continue;\r
+ }\r
+ ListIterator<String> li = fi.getFvImageNamesList().listIterator();\r
+ while (li.hasNext()) {\r
+ String name = li.next();\r
+ vFvNames.remove(name);\r
+ }\r
+ if (vFvNames.size() == 0) {\r
+ cursor.dispose();\r
+ return pos;\r
+ }\r
+ \r
+ }while (cursor.toNextSibling(qFvImage));\r
+ \r
+ }\r
+ cursor.dispose();\r
+ return -1;\r
+ }\r
/**Get FvImage Options for FvImage i\r
* @param i the ith FvImage\r
*/\r
}\r
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){\r
+ cursor.dispose();\r
return;\r
}\r
ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r
m.put(nv.getName(), nv.getValue());\r
}\r
}\r
+ cursor.dispose();\r
}\r
\r
/**\r